@@ -12,7 +12,7 @@ import Icon from '../../../../components/Icon/Icon';
1212import ProblemFilter , { problemFilterType } from '../../../../components/ProblemFilter/ProblemFilter' ;
1313import { Illustration } from '../../../../components/Illustration' ;
1414
15- import { getNetworkInfo } from '../../../../store/reducers/network' ;
15+ import { getNetworkInfo , setDataWasNotLoaded } from '../../../../store/reducers/network' ;
1616import { hideTooltip , showTooltip } from '../../../../store/reducers/tooltip' ;
1717import { ALL , PROBLEMS } from '../../../../utils/constants' ;
1818import { changeFilter } from '../../../../store/reducers/settings' ;
@@ -26,6 +26,7 @@ const b = cn('network');
2626class Network extends React . Component {
2727 static propTypes = {
2828 getNetworkInfo : PropTypes . func ,
29+ setDataWasNotLoaded : PropTypes . func ,
2930 netWorkInfo : PropTypes . object ,
3031 hideTooltip : PropTypes . func ,
3132 showTooltip : PropTypes . func ,
@@ -75,16 +76,27 @@ class Network extends React.Component {
7576 }
7677
7778 componentDidUpdate ( prevProps ) {
78- const { autorefresh, path} = this . props ;
79+ const { autorefresh, path, setDataWasNotLoaded , getNetworkInfo } = this . props ;
7980
80- if ( autorefresh && ! prevProps . autorefresh ) {
81- getNetworkInfo ( path ) ;
81+ const restartAutorefresh = ( ) => {
82+ this . autofetcher . stop ( ) ;
8283 this . autofetcher . start ( ) ;
8384 this . autofetcher . fetch ( ( ) => getNetworkInfo ( path ) ) ;
85+ } ;
86+
87+ if ( autorefresh && ! prevProps . autorefresh ) {
88+ getNetworkInfo ( path ) ;
89+ restartAutorefresh ( ) ;
8490 }
8591 if ( ! autorefresh && prevProps . autorefresh ) {
8692 this . autofetcher . stop ( ) ;
8793 }
94+
95+ if ( path !== prevProps . path ) {
96+ setDataWasNotLoaded ( ) ;
97+ getNetworkInfo ( path ) ;
98+ restartAutorefresh ( ) ;
99+ }
88100 }
89101
90102 componentWillUnmount ( ) {
@@ -364,6 +376,7 @@ const mapDispatchToProps = {
364376 hideTooltip,
365377 showTooltip,
366378 changeFilter,
379+ setDataWasNotLoaded,
367380} ;
368381
369382export default connect ( mapStateToProps , mapDispatchToProps ) ( Network ) ;
0 commit comments