@@ -67,32 +67,32 @@ export default function plotComponentFactory(Plotly) {
67
67
updatePlotly ( shouldInvokeResizeHandler , figureCallbackFunction , shouldAttachUpdateEvents ) {
68
68
this . p = this . p
69
69
. then ( ( ) => {
70
+ if ( this . unmounting ) {
71
+ return ;
72
+ }
70
73
if ( ! this . el ) {
71
- let error ;
72
- if ( this . unmounting ) {
73
- error = new Error ( 'Component is unmounting' ) ;
74
- error . reason = 'unmounting' ;
75
- } else {
76
- error = new Error ( 'Missing element reference' ) ;
77
- }
78
- throw error ;
74
+ throw new Error ( 'Missing element reference' ) ;
79
75
}
76
+ // eslint-disable-next-line consistent-return
80
77
return Plotly . react ( this . el , {
81
78
data : this . props . data ,
82
79
layout : this . props . layout ,
83
80
config : this . props . config ,
84
81
frames : this . props . frames ,
85
82
} ) ;
86
83
} )
87
- . then ( ( ) => this . syncWindowResize ( shouldInvokeResizeHandler ) )
88
- . then ( this . syncEventHandlers )
89
- . then ( ( ) => this . figureCallback ( figureCallbackFunction ) )
90
- . then ( shouldAttachUpdateEvents ? this . attachUpdateEvents : ( ) => { } )
91
- . catch ( err => {
92
- if ( err . reason === 'unmounting' ) {
84
+ . then ( ( ) => {
85
+ if ( this . unmounting ) {
93
86
return ;
94
87
}
95
- console . error ( 'Error while plotting:' , err ) ; // eslint-disable-line no-console
88
+ this . syncWindowResize ( shouldInvokeResizeHandler ) ;
89
+ this . syncEventHandlers ( ) ;
90
+ this . figureCallback ( figureCallbackFunction ) ;
91
+ if ( shouldAttachUpdateEvents ) {
92
+ this . attachUpdateEvents ( ) ;
93
+ }
94
+ } )
95
+ . catch ( err => {
96
96
if ( this . props . onError ) {
97
97
this . props . onError ( err ) ;
98
98
}
0 commit comments