diff --git a/src/components/Header/RefreshInterval.tsx b/src/components/Header/RefreshInterval.tsx index d3bfe076..f3d56937 100644 --- a/src/components/Header/RefreshInterval.tsx +++ b/src/components/Header/RefreshInterval.tsx @@ -6,6 +6,7 @@ import { useEffect, useMemo, useRef } from 'react'; import { REFRESH_INTERVALS } from '@/constants/timeConstants'; import classes from './styles/LogQuery.module.css'; import { useLogsStore, logsStoreReducers } from '@/pages/Stream/providers/LogsProvider'; +import _ from 'lodash'; const { setRefreshInterval, getCleanStoreForRefetch } = logsStoreReducers; const RefreshInterval: FC = () => { @@ -38,9 +39,7 @@ const RefreshInterval: FC = () => { timerRef.current = intervalId; } - return () => { - clearIntervalInstance() - } + return () => timerRef.current ? clearInterval(timerRef.current) : _.noop(); }, [refreshInterval]); const { intervalbtn } = classes; diff --git a/src/pages/Systems/ServerDetails.tsx b/src/pages/Systems/ServerDetails.tsx index 866e11a2..8607b267 100644 --- a/src/pages/Systems/ServerDetails.tsx +++ b/src/pages/Systems/ServerDetails.tsx @@ -63,7 +63,7 @@ const ServerDetail = () => { timerRef.current = intervalId; } - return () => clearIntervalInstance(); + return () => timerRef.current ? clearInterval(timerRef.current) : _.noop(); }, [clusterStore.currentMachine]); return (