Skip to content

Commit

Permalink
Fixed time issue on stream change
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen5959 committed Dec 3, 2024
1 parent a54091c commit be450d2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/layouts/MainLayout/providers/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);

Expand Down

0 comments on commit be450d2

Please sign in to comment.