diff --git a/src/pages/Stream/Views/Explore/useLogsFetcher.ts b/src/pages/Stream/Views/Explore/useLogsFetcher.ts index dc2ba3c2..8f50ce22 100644 --- a/src/pages/Stream/Views/Explore/useLogsFetcher.ts +++ b/src/pages/Stream/Views/Explore/useLogsFetcher.ts @@ -15,7 +15,7 @@ const useLogsFetcher = (props: { isStoreSyncing: boolean }) => { const { currentOffset, currentPage, pageData, totalCount } = tableOpts; const { getQueryData, loading: logsLoading, error: errorMessage } = useQueryLogs(); - const { refetchCount, isCountLoading, isCountRefetching } = useFetchCount(); + const { isCountLoading, isCountRefetching } = useFetchCount(); const hasContentLoaded = !isCountLoading && !logsLoading && !isCountRefetching; const hasNoData = hasContentLoaded && !errorMessage && pageData.length === 0; const showTable = hasContentLoaded && !hasNoData && !errorMessage; @@ -23,7 +23,6 @@ const useLogsFetcher = (props: { isStoreSyncing: boolean }) => { useEffect(() => { setAppStore(syncTimeRange); setLogsStore(setCleanStoreForStreamChange); - refetchCount(); }, [currentStream]); useEffect(() => { diff --git a/src/pages/Stream/index.tsx b/src/pages/Stream/index.tsx index 20d1470b..47800fbc 100644 --- a/src/pages/Stream/index.tsx +++ b/src/pages/Stream/index.tsx @@ -15,6 +15,7 @@ import { useParams } from 'react-router-dom'; import { STREAM_VIEWS } from '@/constants/routes'; import LogsView from './Views/Explore/LogsView'; import useParamsController from './hooks/useParamsController'; +import { useFetchCount } from '@/hooks/useQueryResult'; const { streamChangeCleanup, toggleSideBar } = streamStoreReducers; @@ -24,18 +25,23 @@ const Stream: FC = () => { const [currentStream] = useAppStore((store) => store.currentStream); const { isStoreSynced } = useParamsController(); const [maximized] = useAppStore((store) => store.maximized); + const [timeRange] = useAppStore((store) => store.timeRange); const [instanceConfig] = useAppStore((store) => store.instanceConfig); const [, setStreamStore] = useStreamStore((store) => store.sideBarOpen); + const { refetchCount } = useFetchCount(); useHotkeys([['mod+/', () => setStreamStore((store) => toggleSideBar(store))]]); useEffect(() => { if (isStoreSynced) { if (!_.isEmpty(currentStream)) { - if (view === 'explore') setStreamStore(streamChangeCleanup); + if (view === 'explore') { + setStreamStore(streamChangeCleanup); + refetchCount(); + } } } - }, [isStoreSynced, currentStream]); + }, [isStoreSynced, currentStream, timeRange]); const sideBarWidth = SECONDARY_SIDEBAR_WIDTH;