@@ -64,25 +64,6 @@ export default function plotComponentFactory(Plotly) {
64
64
this . updatePlotly = this . updatePlotly . bind ( this ) ;
65
65
}
66
66
67
- shouldComponentUpdate ( nextProps ) {
68
- // frames *always* changes identity so fall back to check length only :(
69
- const numPrevFrames =
70
- this . props . frames && this . props . frames . length ? this . props . frames . length : 0 ;
71
- const numNextFrames =
72
- nextProps . frames && nextProps . frames . length ? nextProps . frames . length : 0 ;
73
-
74
- const figureChanged = ! (
75
- nextProps . layout === this . props . layout &&
76
- nextProps . data === this . props . data &&
77
- nextProps . config === this . props . config &&
78
- numNextFrames === numPrevFrames
79
- ) ;
80
- const revisionDefined = nextProps . revision !== void 0 ;
81
- const revisionChanged = nextProps . revision !== this . props . revision ;
82
-
83
- return figureChanged || ( revisionDefined && revisionChanged ) ;
84
- }
85
-
86
67
updatePlotly (
87
68
props ,
88
69
shouldInvokeResizeHandler ,
@@ -132,6 +113,25 @@ export default function plotComponentFactory(Plotly) {
132
113
componentDidUpdate ( nextProps ) {
133
114
this . unmounting = false ;
134
115
116
+ // frames *always* changes identity so fall back to check length only :(
117
+ const numPrevFrames =
118
+ this . props . frames && this . props . frames . length ? this . props . frames . length : 0 ;
119
+ const numNextFrames =
120
+ nextProps . frames && nextProps . frames . length ? nextProps . frames . length : 0 ;
121
+
122
+ const figureChanged = ! (
123
+ nextProps . layout === this . props . layout &&
124
+ nextProps . data === this . props . data &&
125
+ nextProps . config === this . props . config &&
126
+ numNextFrames === numPrevFrames
127
+ ) ;
128
+ const revisionDefined = nextProps . revision !== void 0 ;
129
+ const revisionChanged = nextProps . revision !== this . props . revision ;
130
+
131
+ if ( ! figureChanged && ( ! revisionDefined || ( revisionDefined && ! revisionChanged ) ) ) {
132
+ return ;
133
+ }
134
+
135
135
this . updatePlotly ( nextProps , false , nextProps . onUpdate , false ) ;
136
136
}
137
137
0 commit comments