Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/containers/Tenant/Schema/SchemaViewer/SchemaViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ export const SchemaViewer = ({type, path, tenantName, extended = false}: SchemaV
// Refresh table only in Diagnostics
const pollingInterval = extended ? autoRefreshInterval : undefined;

const {currentData: schemaData, isLoading: loading} = overviewApi.useGetOverviewQuery(
const {currentData: schemaData, isFetching} = overviewApi.useGetOverviewQuery(
{path, database: tenantName},
{pollingInterval},
);

// useGetOverviewQuery is called in Tenant, so isLoading will be always false in this component
// to show loader properly, we need to check isFetching and currentData
const loading = isFetching && schemaData === undefined;

const viewSchemaRequestParams = isViewType(type) ? {path, database: tenantName} : skipToken;

const {data: viewColumnsData, isLoading: isViewSchemaLoading} =
const {currentData: viewColumnsData, isLoading: isViewSchemaLoading} =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually we can still use data - as it will update as soon as data fetched

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not properly updated when you change objects in schema tree. So you have a chance to see data of a previous object until current object data is loaded

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can try it here - change schema object from my_view3 to my_view2 with slowed internet

https://nda.ya.ru/t/rgNzLIaw7CqxSx

Copy link
Collaborator

@astandrik astandrik Mar 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean we have

    if (loading || isViewSchemaLoading) {
        return <TableSkeleton />;
    }

I would expect that until data is fully loaded/fetched we would see skeleton?

viewSchemaApi.useGetViewSchemaQuery(viewSchemaRequestParams, {pollingInterval});

const tableData = React.useMemo(() => {
Expand Down
Loading