Bug 1462229 - Part 2: Avoid updating SummaryGraphPath if the component have been destroyed or other node have been selected while calling async function. r?gl draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Mon, 28 May 2018 08:57:30 +0900
changeset 800406 cef0e7c556903400248a0daf75d323eea19cfde1
parent 800405 57019660f2fac0f07804e1fe8b6bf4d3fe35dac8
child 800407 5c288c899cbcd57c7b942445ae78aa6c119ad658
child 800409 d93c389b4597b6d9a46cec8a25f3fb57af3bd25c
push id111342
push userbmo:dakatsuka@mozilla.com
push dateMon, 28 May 2018 00:23:27 +0000
reviewersgl
bugs1462229
milestone62.0a1
Bug 1462229 - Part 2: Avoid updating SummaryGraphPath if the component have been destroyed or other node have been selected while calling async function. r?gl MozReview-Commit-ID: 2ECelUt6nmd
devtools/client/inspector/animation/components/graph/SummaryGraphPath.js
--- a/devtools/client/inspector/animation/components/graph/SummaryGraphPath.js
+++ b/devtools/client/inspector/animation/components/graph/SummaryGraphPath.js
@@ -150,29 +150,29 @@ class SummaryGraphPath extends Component
     const {
       animation,
       emitEventForTest,
       getAnimatedPropertyMap,
       timeScale,
     } = props;
 
     let animatedPropertyMap = null;
+    let thisEl = null;
 
     try {
       animatedPropertyMap = await getAnimatedPropertyMap(animation);
+      thisEl = ReactDOM.findDOMNode(this);
     } catch (e) {
       // Expected if we've already been destroyed or other node have been selected
       // in the meantime.
       console.error(e);
       return;
     }
 
     const keyframesList = this.getOffsetAndEasingOnlyKeyframes(animatedPropertyMap);
-
-    const thisEl = ReactDOM.findDOMNode(this);
     const totalDuration = timeScale.getDuration() * animation.state.playbackRate;
     const durationPerPixel = totalDuration / thisEl.parentNode.clientWidth;
 
     this.setState(
       {
         durationPerPixel,
         isStateUpdating: false,
         keyframesList