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
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Mon, 28 May 2018 08:57:30 +0900
changeset 420091 452e577be2f4e4ffc7e7415572187e1d4c5f60af
parent 420090 453e9dd459a2a30a7e2dc6a0c847834f461c4d84
child 420092 6fa5b5963b06eb4984a59629b1fc1d005579e462
push id64504
push userdakatsuka@mozilla.com
push dateMon, 28 May 2018 04:53:06 +0000
treeherderautoland@443ff1adf8ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgl
bugs1462229
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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