Skip to content

Commit 764a2ff

Browse files
fix(ShemaViewer): show loader correctly
1 parent 7aacdfe commit 764a2ff

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/containers/Tenant/Schema/SchemaViewer/SchemaViewer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,18 @@ export const SchemaViewer = ({type, path, tenantName, extended = false}: SchemaV
4242
// Refresh table only in Diagnostics
4343
const pollingInterval = extended ? autoRefreshInterval : undefined;
4444

45-
const {currentData: schemaData, isLoading: loading} = overviewApi.useGetOverviewQuery(
45+
const {currentData: schemaData, isFetching} = overviewApi.useGetOverviewQuery(
4646
{path, database: tenantName},
4747
{pollingInterval},
4848
);
4949

50+
// useGetOverviewQuery is called in Tenant, so isLoading will be always false in this component
51+
// to show loader properly, we need to check isFetching and currentData
52+
const loading = isFetching && schemaData === undefined;
53+
5054
const viewSchemaRequestParams = isViewType(type) ? {path, database: tenantName} : skipToken;
5155

52-
const {data: viewColumnsData, isLoading: isViewSchemaLoading} =
56+
const {currentData: viewColumnsData, isLoading: isViewSchemaLoading} =
5357
viewSchemaApi.useGetViewSchemaQuery(viewSchemaRequestParams, {pollingInterval});
5458

5559
const tableData = React.useMemo(() => {

0 commit comments

Comments
 (0)