From be450d22395f0699e100ab0a13cd8ee220bcface Mon Sep 17 00:00:00 2001 From: Praveen K B Date: Tue, 3 Dec 2024 20:09:26 +0530 Subject: [PATCH] Fixed time issue on stream change --- src/layouts/MainLayout/providers/AppProvider.tsx | 3 +-- src/pages/Home/index.tsx | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layouts/MainLayout/providers/AppProvider.tsx b/src/layouts/MainLayout/providers/AppProvider.tsx index 43a298f0..01edea2d 100644 --- a/src/layouts/MainLayout/providers/AppProvider.tsx +++ b/src/layouts/MainLayout/providers/AppProvider.tsx @@ -134,9 +134,8 @@ function getHTTPContext() { // reducers const syncTimeRange = (store: AppStore) => { const { timeRange } = store; - const { interval, type } = timeRange; const duration = _.find(FIXED_DURATIONS, (duration) => duration.milliseconds === timeRange.interval); - const updatedTimeRange = interval && type === 'fixed' && { timeRange: getDefaultTimeRange(duration) }; + const updatedTimeRange = { timeRange: getDefaultTimeRange(duration) }; return { ...updatedTimeRange, }; diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index a4b22d33..7631df8d 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -31,7 +31,7 @@ import _ from 'lodash'; import { heights } from '@/components/Mantine/sizing'; import { PRIMARY_HEADER_HEIGHT } from '@/constants/theme'; -const { changeStream, toggleCreateStreamModal } = appStoreReducers; +const { changeStream, toggleCreateStreamModal, syncTimeRange } = appStoreReducers; type NoStreamsViewProps = { hasCreateStreamAccess: boolean; @@ -89,6 +89,7 @@ const Home: FC = () => { useEffect(() => { if (!Array.isArray(userSpecificStreams) || userSpecificStreams.length === 0 || !userRoles) return; + setAppStore((store) => syncTimeRange(store)); getStreamMetadata(userSpecificStreams.map((stream) => stream.name)); }, [userSpecificStreams, userRoles]);