Bug 1464849: Avoid to render the graph in case of animation was removed. r?gl draft
authorDaisuke Akatsuka <dakatsuka@mozilla.com>
Tue, 29 May 2018 18:12:38 +0900
changeset 800815 ee2f779b9962e7ce151af3fd396759b646fa28d2
parent 800814 ce830edff5db5798b83d09e5ea5eab2fae7f6880
push id111489
push userbmo:dakatsuka@mozilla.com
push dateTue, 29 May 2018 09:13:26 +0000
reviewersgl
bugs1464849
milestone62.0a1
Bug 1464849: Avoid to render the graph in case of animation was removed. r?gl MozReview-Commit-ID: HREpfImDKum
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
@@ -179,27 +179,25 @@ class SummaryGraphPath extends Component
       }
     );
 
     emitEventForTest("animation-summary-graph-rendered");
   }
 
   render() {
     const { durationPerPixel, keyframesList } = this.state;
+    const { animation, simulateAnimation, timeScale } = this.props;
 
-    if (!durationPerPixel) {
+    if (!durationPerPixel || !animation.state.type) {
+      // Undefined animation.state.type means that the animation had been removed already.
+      // Even if the animation was removed, we still need the empty svg since the
+      // component might be re-used.
       return dom.svg();
     }
 
-    const {
-      animation,
-      simulateAnimation,
-      timeScale,
-    } = this.props;
-
     const { createdTime, playbackRate } = animation.state;
 
     // If createdTime is not defined (which happens when connected to server older
     // than FF62), use previousStartTime instead. See bug 1454392
     const baseTime = typeof createdTime === "undefined"
                        ? (animation.state.previousStartTime || 0)
                        : createdTime;
     // Absorb the playbackRate in viewBox of SVG and offset of child path elements