@@ -63,6 +63,7 @@ export default function plotComponentFactory(Plotly) {
63
63
this . attachUpdateEvents = this . attachUpdateEvents . bind ( this ) ;
64
64
this . getRef = this . getRef . bind ( this ) ;
65
65
this . handleUpdate = this . handleUpdate . bind ( this ) ;
66
+ this . handleUpdateWithProps = this . handleUpdateWithProps . bind ( this ) ;
66
67
}
67
68
68
69
shouldComponentUpdate ( nextProps ) {
@@ -73,7 +74,6 @@ export default function plotComponentFactory(Plotly) {
73
74
}
74
75
75
76
componentDidMount ( ) {
76
- if ( ! isBrowser ) return ;
77
77
this . p = this . p
78
78
. then ( ( ) => {
79
79
return Plotly . newPlot ( this . el , {
@@ -96,7 +96,6 @@ export default function plotComponentFactory(Plotly) {
96
96
}
97
97
98
98
componentWillUpdate ( nextProps ) {
99
- if ( ! isBrowser ) return ;
100
99
this . p = this . p
101
100
. then ( ( ) => {
102
101
if ( hasReactAPIMethod ) {
@@ -121,7 +120,7 @@ export default function plotComponentFactory(Plotly) {
121
120
. then ( ( ) => {
122
121
if ( ! hasReactAPIMethod ) this . attachUpdateEvents ( ) ;
123
122
} )
124
- . then ( ( ) => this . handleUpdate ( nextProps ) )
123
+ . then ( ( ) => this . handleUpdateWithProps ( nextProps ) )
125
124
. catch ( err => {
126
125
console . error ( 'Error while plotting:' , err ) ;
127
126
this . props . onError && this . props . onError ( err ) ;
@@ -162,8 +161,11 @@ export default function plotComponentFactory(Plotly) {
162
161
}
163
162
}
164
163
165
- handleUpdate ( props ) {
166
- props = props || this . props ;
164
+ handleUpdate ( ) {
165
+ this . handleUpdateWithProps ( this . props ) ;
166
+ }
167
+
168
+ handleUpdateWithProps ( props ) {
167
169
if ( props . onUpdate && typeof props . onUpdate === 'function' ) {
168
170
props . onUpdate ( this . el ) ;
169
171
}
0 commit comments