diff --git a/src/components/Header/RefreshInterval.tsx b/src/components/Header/RefreshInterval.tsx
index 648272c5..fbc05103 100644
--- a/src/components/Header/RefreshInterval.tsx
+++ b/src/components/Header/RefreshInterval.tsx
@@ -10,7 +10,7 @@ import _ from 'lodash';
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
const { setRefreshInterval, getCleanStoreForRefetch } = logsStoreReducers;
-const { setCleanAppStore } = appStoreReducers;
+const { syncTimeRange } = appStoreReducers;
const RefreshInterval: FC = () => {
const [, setAppStore] = useAppStore((_store) => null);
const [refreshInterval, setLogsStore] = useLogsStore((store) => store.refreshInterval);
@@ -37,7 +37,7 @@ const RefreshInterval: FC = () => {
clearIntervalInstance();
if (refreshInterval !== null) {
const intervalId = setInterval(() => {
- setAppStore(setCleanAppStore);
+ setAppStore(syncTimeRange);
setLogsStore(getCleanStoreForRefetch);
}, refreshInterval);
timerRef.current = intervalId;
diff --git a/src/components/Header/RefreshNow.tsx b/src/components/Header/RefreshNow.tsx
index dfd7ba57..0744be61 100644
--- a/src/components/Header/RefreshNow.tsx
+++ b/src/components/Header/RefreshNow.tsx
@@ -6,7 +6,7 @@ import IconButton from '../Button/IconButton';
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
const { getCleanStoreForRefetch } = logsStoreReducers;
-const { setCleanAppStore } = appStoreReducers;
+const { syncTimeRange } = appStoreReducers;
const renderRefreshIcon = () => ;
@@ -15,7 +15,7 @@ const RefreshNow: FC = () => {
const [, setAppStore] = useAppStore((_store) => null);
const onRefresh = useCallback(() => {
- setAppStore((store) => setCleanAppStore(store));
+ setAppStore((store) => syncTimeRange(store));
setLogsStore((store) => getCleanStoreForRefetch(store));
}, []);
return ;
diff --git a/src/layouts/MainLayout/providers/AppProvider.tsx b/src/layouts/MainLayout/providers/AppProvider.tsx
index 805b65fc..43a298f0 100644
--- a/src/layouts/MainLayout/providers/AppProvider.tsx
+++ b/src/layouts/MainLayout/providers/AppProvider.tsx
@@ -78,7 +78,7 @@ type AppStoreReducers = {
changeStream: (store: AppStore, stream: string) => ReducerOutput;
setUserRoles: (store: AppStore, roles: UserRoles | null) => ReducerOutput;
setshiftInterval: (store: AppStore, interval: number) => ReducerOutput;
- setCleanAppStore: (store: AppStore) => ReducerOutput;
+ syncTimeRange: (store: AppStore) => ReducerOutput;
setUserSpecificStreams: (store: AppStore, userSpecficStreams: LogStreamData | null) => ReducerOutput;
setUserAccessMap: (store: AppStore, accessRoles: string[] | null) => ReducerOutput;
setStreamSpecificUserAccess: (store: AppStore, streamSpecificUserAccess: string[] | null) => ReducerOutput;
@@ -132,7 +132,7 @@ function getHTTPContext() {
return window.isSecureContext;
}
// reducers
-const setCleanAppStore = (store: AppStore) => {
+const syncTimeRange = (store: AppStore) => {
const { timeRange } = store;
const { interval, type } = timeRange;
const duration = _.find(FIXED_DURATIONS, (duration) => duration.milliseconds === timeRange.interval);
@@ -251,7 +251,7 @@ const appStoreReducers: AppStoreReducers = {
setSavedFilters,
setTimeRange,
setshiftInterval,
- setCleanAppStore,
+ syncTimeRange,
applyQueryWithResetTime,
};
diff --git a/src/pages/Stream/Views/Explore/LoadingViews.tsx b/src/pages/Stream/Views/Explore/LoadingViews.tsx
index 17be083e..4505af4c 100644
--- a/src/pages/Stream/Views/Explore/LoadingViews.tsx
+++ b/src/pages/Stream/Views/Explore/LoadingViews.tsx
@@ -6,7 +6,7 @@ import classes from '../../styles/Logs.module.css';
import { appStoreReducers, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
const { getCleanStoreForRefetch } = logsStoreReducers;
-const { setCleanAppStore } = appStoreReducers;
+const { syncTimeRange } = appStoreReducers;
export const ErrorView = (props: { message: string }) => {
const [, setLogsStore] = useLogsStore((_store) => null);
@@ -14,7 +14,7 @@ export const ErrorView = (props: { message: string }) => {
const { message } = props;
const onRetry = useCallback(() => {
- setAppStore((store) => setCleanAppStore(store));
+ setAppStore((store) => syncTimeRange(store));
setLogsStore((store) => getCleanStoreForRefetch(store));
}, []);
return (
diff --git a/src/pages/Stream/Views/Explore/useLogsFetcher.ts b/src/pages/Stream/Views/Explore/useLogsFetcher.ts
index 43e08315..96a6435e 100644
--- a/src/pages/Stream/Views/Explore/useLogsFetcher.ts
+++ b/src/pages/Stream/Views/Explore/useLogsFetcher.ts
@@ -6,7 +6,7 @@ import { useFetchCount } from '@/hooks/useQueryResult';
import { useStreamStore } from '../../providers/StreamProvider';
const { setCleanStoreForStreamChange } = logsStoreReducers;
-const { setCleanAppStore } = appStoreReducers;
+const { syncTimeRange } = appStoreReducers;
const useLogsFetcher = (props: { schemaLoading: boolean; infoLoading: boolean }) => {
const { schemaLoading, infoLoading } = props;
@@ -24,7 +24,7 @@ const useLogsFetcher = (props: { schemaLoading: boolean; infoLoading: boolean })
const showTable = hasContentLoaded && !hasNoData && !errorMessage;
useEffect(() => {
- setAppStore(setCleanAppStore);
+ setAppStore(syncTimeRange);
setLogsStore(setCleanStoreForStreamChange);
}, [currentStream]);
diff --git a/src/pages/Stream/components/Querier/SavedFiltersModal.tsx b/src/pages/Stream/components/Querier/SavedFiltersModal.tsx
index 5a8fc70e..d60887a2 100644
--- a/src/pages/Stream/components/Querier/SavedFiltersModal.tsx
+++ b/src/pages/Stream/components/Querier/SavedFiltersModal.tsx
@@ -18,7 +18,7 @@ import { useLocation } from 'react-router-dom';
const { toggleSavedFiltersModal, resetFilters, parseQuery, applySavedFilters, setAppliedFilterQuery } =
filterStoreReducers;
const { applyCustomQuery, updateSavedFilterId, getCleanStoreForRefetch } = logsStoreReducers;
-const { setCleanAppStore, setTimeRange, applyQueryWithResetTime } = appStoreReducers;
+const { syncTimeRange, setTimeRange, applyQueryWithResetTime } = appStoreReducers;
const renderDeleteIcon = () => ;
const renderCloseIcon = () => ;
@@ -229,7 +229,7 @@ const SavedFiltersModal = () => {
);
const hardRefresh = useCallback(() => {
- setAppStore((store) => setCleanAppStore(store));
+ setAppStore((store) => syncTimeRange(store));
setLogsStore((store) => getCleanStoreForRefetch(store));
closeModal();
}, []);
diff --git a/src/pages/Stream/components/Querier/index.tsx b/src/pages/Stream/components/Querier/index.tsx
index 43fdcaa7..4ca6dbb8 100644
--- a/src/pages/Stream/components/Querier/index.tsx
+++ b/src/pages/Stream/components/Querier/index.tsx
@@ -19,7 +19,7 @@ const { setFields, parseQuery, storeAppliedQuery, resetFilters, toggleSubmitBtn,
const { toggleQueryBuilder, toggleCustQuerySearchViewMode, applyCustomQuery, resetCustQuerySearchState } =
logsStoreReducers;
-const { applyQueryWithResetTime, setCleanAppStore } = appStoreReducers;
+const { applyQueryWithResetTime, syncTimeRange } = appStoreReducers;
const getLabel = (mode: string | null) => {
return mode === 'filters' ? 'Filters' : mode === 'sql' ? 'SQL' : '';
@@ -183,7 +183,7 @@ const Querier = () => {
const onClear = useCallback(() => {
setFilterStore((store) => resetFilters(store));
- setAppStore((store) => setCleanAppStore(store));
+ setAppStore((store) => syncTimeRange(store));
setLogsStore((store) => resetCustQuerySearchState(store));
}, []);
diff --git a/src/pages/Stream/hooks/useParamsController.ts b/src/pages/Stream/hooks/useParamsController.ts
index 39e56349..b7894003 100644
--- a/src/pages/Stream/hooks/useParamsController.ts
+++ b/src/pages/Stream/hooks/useParamsController.ts
@@ -12,8 +12,8 @@ import { generateQueryBuilderASTFromSQL } from '../utils';
import { appStoreReducers, TimeRange, useAppStore } from '@/layouts/MainLayout/providers/AppProvider';
const { getRelativeStartAndEndDate, formatDateWithTimezone, getLocalTimezone } = timeRangeUtils;
-const { onToggleView, setPerPage, setCustQuerySearchState, getCleanStoreForRefetch } = logsStoreReducers;
-const { setTimeRange, setCleanAppStore } = appStoreReducers;
+const { onToggleView, setPerPage, setCustQuerySearchState } = logsStoreReducers;
+const { setTimeRange, syncTimeRange } = appStoreReducers;
const { applySavedFilters } = filterStoreReducers;
const timeRangeFormat = 'DD-MMM-YYYY_HH-mmz';
const keys = ['view', 'rows', 'interval', 'from', 'to', 'query', 'filterType'];
@@ -117,7 +117,7 @@ const useParamsController = () => {
}
if (storeAsParams.query !== presentParams.query) {
- setAppStore((store) => setCleanAppStore(store));
+ setAppStore((store) => syncTimeRange(store));
setLogsStore((store) => setCustQuerySearchState(store, presentParams.query, presentParams.filterType));
if (presentParams.filterType === 'filters')
setFilterStore((store) =>
@@ -174,7 +174,7 @@ const useParamsController = () => {
setFilterStore((store) =>
applySavedFilters(store, generateQueryBuilderASTFromSQL(presentParams.query) as QueryType),
);
- setAppStore((store) => setCleanAppStore(store));
+ setAppStore((store) => syncTimeRange(store));
setLogsStore((store) => setCustQuerySearchState(store, presentParams.query, presentParams.filterType));
}
syncTimeRangeToStore(storeAsParams, presentParams);
@@ -188,8 +188,6 @@ const useParamsController = () => {
if (!duration) return;
const { startTime, endTime } = getRelativeStartAndEndDate(duration);
- setAppStore((store) => setCleanAppStore(store));
- setLogsStore((store) => getCleanStoreForRefetch(store));
return setAppStore((store) => setTimeRange(store, { startTime, endTime, type: 'fixed' }));
}
} else if (_.has(presentParams, 'from') && _.has(presentParams, 'to')) {
@@ -197,8 +195,6 @@ const useParamsController = () => {
const startTime = dateParamStrToDateObj(presentParams.from);
const endTime = dateParamStrToDateObj(presentParams.to);
if (_.isDate(startTime) && _.isDate(endTime)) {
- setAppStore((store) => setCleanAppStore(store));
- setLogsStore((store) => getCleanStoreForRefetch(store));
return setAppStore((store) =>
setTimeRange(store, { startTime: dayjs(startTime), endTime: dayjs(endTime), type: 'custom' }),
);