@@ -12,7 +12,7 @@ import Icon from '../../../../components/Icon/Icon';
12
12
import ProblemFilter , { problemFilterType } from '../../../../components/ProblemFilter/ProblemFilter' ;
13
13
import { Illustration } from '../../../../components/Illustration' ;
14
14
15
- import { getNetworkInfo } from '../../../../store/reducers/network' ;
15
+ import { getNetworkInfo , setDataWasNotLoaded } from '../../../../store/reducers/network' ;
16
16
import { hideTooltip , showTooltip } from '../../../../store/reducers/tooltip' ;
17
17
import { ALL , PROBLEMS } from '../../../../utils/constants' ;
18
18
import { changeFilter } from '../../../../store/reducers/settings' ;
@@ -26,6 +26,7 @@ const b = cn('network');
26
26
class Network extends React . Component {
27
27
static propTypes = {
28
28
getNetworkInfo : PropTypes . func ,
29
+ setDataWasNotLoaded : PropTypes . func ,
29
30
netWorkInfo : PropTypes . object ,
30
31
hideTooltip : PropTypes . func ,
31
32
showTooltip : PropTypes . func ,
@@ -75,16 +76,27 @@ class Network extends React.Component {
75
76
}
76
77
77
78
componentDidUpdate ( prevProps ) {
78
- const { autorefresh, path} = this . props ;
79
+ const { autorefresh, path, setDataWasNotLoaded , getNetworkInfo } = this . props ;
79
80
80
- if ( autorefresh && ! prevProps . autorefresh ) {
81
- getNetworkInfo ( path ) ;
81
+ const restartAutorefresh = ( ) => {
82
+ this . autofetcher . stop ( ) ;
82
83
this . autofetcher . start ( ) ;
83
84
this . autofetcher . fetch ( ( ) => getNetworkInfo ( path ) ) ;
85
+ } ;
86
+
87
+ if ( autorefresh && ! prevProps . autorefresh ) {
88
+ getNetworkInfo ( path ) ;
89
+ restartAutorefresh ( ) ;
84
90
}
85
91
if ( ! autorefresh && prevProps . autorefresh ) {
86
92
this . autofetcher . stop ( ) ;
87
93
}
94
+
95
+ if ( path !== prevProps . path ) {
96
+ setDataWasNotLoaded ( ) ;
97
+ getNetworkInfo ( path ) ;
98
+ restartAutorefresh ( ) ;
99
+ }
88
100
}
89
101
90
102
componentWillUnmount ( ) {
@@ -364,6 +376,7 @@ const mapDispatchToProps = {
364
376
hideTooltip,
365
377
showTooltip,
366
378
changeFilter,
379
+ setDataWasNotLoaded,
367
380
} ;
368
381
369
382
export default connect ( mapStateToProps , mapDispatchToProps ) ( Network ) ;
0 commit comments