@@ -63,6 +63,7 @@ export default function plotComponentFactory(Plotly) {
6363 this . attachUpdateEvents = this . attachUpdateEvents . bind ( this ) ;
6464 this . getRef = this . getRef . bind ( this ) ;
6565 this . handleUpdate = this . handleUpdate . bind ( this ) ;
66+ this . handleUpdateWithProps = this . handleUpdateWithProps . bind ( this ) ;
6667 }
6768
6869 shouldComponentUpdate ( nextProps ) {
@@ -73,7 +74,6 @@ export default function plotComponentFactory(Plotly) {
7374 }
7475
7576 componentDidMount ( ) {
76- if ( ! isBrowser ) return ;
7777 this . p = this . p
7878 . then ( ( ) => {
7979 return Plotly . newPlot ( this . el , {
@@ -96,7 +96,6 @@ export default function plotComponentFactory(Plotly) {
9696 }
9797
9898 componentWillUpdate ( nextProps ) {
99- if ( ! isBrowser ) return ;
10099 this . p = this . p
101100 . then ( ( ) => {
102101 if ( hasReactAPIMethod ) {
@@ -121,7 +120,7 @@ export default function plotComponentFactory(Plotly) {
121120 . then ( ( ) => {
122121 if ( ! hasReactAPIMethod ) this . attachUpdateEvents ( ) ;
123122 } )
124- . then ( ( ) => this . handleUpdate ( nextProps ) )
123+ . then ( ( ) => this . handleUpdateWithProps ( nextProps ) )
125124 . catch ( err => {
126125 console . error ( 'Error while plotting:' , err ) ;
127126 this . props . onError && this . props . onError ( err ) ;
@@ -162,8 +161,11 @@ export default function plotComponentFactory(Plotly) {
162161 }
163162 }
164163
165- handleUpdate ( props ) {
166- props = props || this . props ;
164+ handleUpdate ( ) {
165+ this . handleUpdateWithProps ( this . props ) ;
166+ }
167+
168+ handleUpdateWithProps ( props ) {
167169 if ( props . onUpdate && typeof props . onUpdate === 'function' ) {
168170 props . onUpdate ( this . el ) ;
169171 }
0 commit comments