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
--- 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