Skip to content

Commit

Permalink
Rename the infoLoading flag
Browse files Browse the repository at this point in the history
  • Loading branch information
praveen5959 committed Jan 8, 2025
1 parent d62b5ce commit 9755746
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/pages/Stream/Views/Explore/LogsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import _ from 'lodash';
const { setPageAndPageData, setTargetPage, setTargetColumns, setDisabledColumns } = logsStoreReducers;
const { toogleQueryParamsFlag } = filterStoreReducers;

const LogsView = (props: { infoLoading: boolean }) => {
const LogsView = (props: { isStoreSyncing: boolean }) => {
const [, setFilterStore] = useFilterStore((store) => store);
const { infoLoading } = props;
const { isStoreSyncing } = props;
const { errorMessage, hasNoData, showTable, isFetchingCount, logsLoading } = useLogsFetcher({
infoLoading,
isStoreSyncing,
});

const [tableOpts] = useLogsStore((store) => store.tableOpts);
Expand Down Expand Up @@ -57,7 +57,7 @@ const LogsView = (props: { infoLoading: boolean }) => {
return (
<Box style={{ display: 'flex', flex: 1, overflow: 'hidden' }}>
{viewMode === 'table' && (
<LogsViewConfig isFetchingCount={isFetchingCount} logsLoading={logsLoading} infoLoading={infoLoading} />
<LogsViewConfig isFetchingCount={isFetchingCount} logsLoading={logsLoading} isStoreSyncing={isStoreSyncing} />
)}
{viewMode === 'table' ? <LogTable {...viewOpts} /> : <JsonView {...viewOpts} />}
</Box>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Stream/Views/Explore/LogsViewConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ const ColumnsList = (props: { isLoading: boolean }) => {
);
};

const LogsViewConfig = (props: { isFetchingCount: boolean; logsLoading: boolean; infoLoading: boolean }) => {
const LogsViewConfig = (props: { isFetchingCount: boolean; logsLoading: boolean; isStoreSyncing: boolean }) => {
const [configViewType] = useLogsStore((store) => store.tableOpts.configViewType);
const [maximized] = useAppStore((store) => store.maximized);
const [{ sideBarOpen }, setStreamStore] = useStreamStore((store) => store);
Expand Down Expand Up @@ -332,9 +332,9 @@ const LogsViewConfig = (props: { isFetchingCount: boolean; logsLoading: boolean;
className={classes.container}>
<Header />
{configViewType === 'schema' ? (
<SchemaList isLoading={props.isFetchingCount || props.infoLoading} />
<SchemaList isLoading={props.isFetchingCount || props.isStoreSyncing} />
) : (
<ColumnsList isLoading={props.logsLoading || props.infoLoading || props.isFetchingCount} />
<ColumnsList isLoading={props.logsLoading || props.isStoreSyncing || props.isFetchingCount} />
)}
</Stack>
<Stack className={classes.collapseBtn}>
Expand Down
14 changes: 7 additions & 7 deletions src/pages/Stream/Views/Explore/useLogsFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useFetchCount } from '@/hooks/useQueryResult';
const { setCleanStoreForStreamChange } = logsStoreReducers;
const { syncTimeRange } = appStoreReducers;

const useLogsFetcher = (props: { infoLoading: boolean }) => {
const { infoLoading } = props;
const useLogsFetcher = (props: { isStoreSyncing: boolean }) => {
const { isStoreSyncing } = props;
const [currentStream] = useAppStore((store) => store.currentStream);
const [{ timeRange }, setAppStore] = useAppStore((store) => store);
const [{ tableOpts }, setLogsStore] = useLogsStore((store) => store);
Expand All @@ -27,23 +27,23 @@ const useLogsFetcher = (props: { infoLoading: boolean }) => {
}, [currentStream]);

useEffect(() => {
if (infoLoading || totalCount === 0) return;
if (isStoreSyncing || totalCount === 0) return;

if (currentPage === 0) {
getQueryData();
}
}, [currentPage, currentStream, timeRange, infoLoading, totalCount]);
}, [currentPage, currentStream, timeRange, isStoreSyncing, totalCount]);

useEffect(() => {
if (infoLoading || totalCount === 0) return;
if (isStoreSyncing || totalCount === 0) return;

if (currentOffset !== 0 && currentPage !== 0) {
getQueryData();
}
}, [currentOffset, infoLoading, totalCount]);
}, [currentOffset, isStoreSyncing, totalCount]);

return {
logsLoading: infoLoading || logsLoading,
logsLoading: isStoreSyncing || logsLoading,
errorMessage,
hasContentLoaded,
hasNoData,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/Stream/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const Stream: FC = () => {
if (!currentStream) return null;
if (!_.includes(STREAM_VIEWS, view)) return null;

const isInfoLoading = (!isStoreSynced || instanceConfig === null) && view === 'explore';
const isStoreSyncing = (!isStoreSynced || instanceConfig === null) && view === 'explore';
return (
<Box
style={{
Expand All @@ -66,7 +66,7 @@ const Stream: FC = () => {
<PrimaryToolbar />
{view === 'explore' && <SecondaryToolbar />}
{view === 'explore' ? (
<LogsView infoLoading={isInfoLoading} />
<LogsView isStoreSyncing={isStoreSyncing} />
) : view === 'live-tail' ? (
<LiveLogTable />
) : (
Expand Down

0 comments on commit 9755746

Please sign in to comment.