fix: Multiple dashboard refresh triggers for the same session (#16094)

This commit is contained in:
Michael S. Molina 2021-08-10 09:12:28 -03:00 committed by GitHub
parent bb1d8fe4ef
commit 07f33998ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -48,7 +48,9 @@ import {
SAVE_TYPE_OVERWRITE,
DASHBOARD_POSITION_DATA_LIMIT,
} from 'src/dashboard/util/constants';
import setPeriodicRunner from 'src/dashboard/util/setPeriodicRunner';
import setPeriodicRunner, {
stopPeriodicRender,
} from 'src/dashboard/util/setPeriodicRunner';
import { options as PeriodicRefreshOptions } from 'src/dashboard/components/RefreshIntervalModal';
const propTypes = {
@ -196,6 +198,8 @@ class Header extends React.PureComponent {
}
componentWillUnmount() {
stopPeriodicRender(this.refreshTimer);
this.props.setRefreshFrequency(0);
clearTimeout(this.ctrlYTimeout);
clearTimeout(this.ctrlZTimeout);
}

View File

@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
const stopPeriodicRender = (refreshTimer?: number) => {
export const stopPeriodicRender = (refreshTimer?: number) => {
if (refreshTimer) {
clearInterval(refreshTimer);
}