File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
x-pack/legacy/plugins/monitoring/public/components/chart Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export class ChartTarget extends React.Component {
3535 componentWillUnmount ( ) {
3636 this . shutdownChart ( ) ;
3737 window . removeEventListener ( 'resize' , this . _handleResize ) ;
38+ this . componentUnmounted = true ;
3839 }
3940
4041 filterByShow ( seriesToShow ) {
@@ -62,7 +63,6 @@ export class ChartTarget extends React.Component {
6263
6364 componentDidMount ( ) {
6465 this . renderChart ( ) ;
65- window . addEventListener ( 'resize' , this . _handleResize , false ) ;
6666 }
6767
6868 componentDidUpdate ( ) {
@@ -94,6 +94,9 @@ export class ChartTarget extends React.Component {
9494 const data = this . filterData ( series , this . props . seriesToShow ) ;
9595
9696 this . plot = $ . plot ( target , data , await this . getOptions ( ) ) ;
97+ if ( this . componentUnmounted || ! this . plot ) {
98+ return ;
99+ }
97100
98101 this . _handleResize = ( ) => {
99102 if ( ! this . plot ) { return ; }
@@ -110,6 +113,8 @@ export class ChartTarget extends React.Component {
110113 }
111114 } ;
112115
116+ window . addEventListener ( 'resize' , this . _handleResize , false ) ;
117+
113118 this . handleMouseLeave = ( ) => {
114119 eventBus . trigger ( 'thorPlotLeave' , [ ] ) ;
115120 } ;
You can’t perform that action at this time.
0 commit comments