console: cache old browse rows introspection calls using react-query

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9101
GitOrigin-RevId: c427bc21d9eec085e38622e4c55b0f597d0ea6f4
This commit is contained in:
Vijay Prasanna 2023-05-10 14:13:49 +05:30 committed by hasura-bot
parent 3ce9c0f4c3
commit 7154855437
3 changed files with 12 additions and 7 deletions

View File

@ -16,11 +16,10 @@ import {
} from './LegacyRunQueryContainer.utils';
import { LegacyRunQuery } from './LegacyRunQuery';
import { FiltersAndSortFormValues, UserQuery } from '../types';
import { useLegacyTableColumns } from '../hooks/useLegacyTableColumns';
import { useTableName } from '../hooks/useTableName';
import { useDatabaseOperators } from '../hooks/useDatabaseOperators';
import { useTableSchema } from '../hooks/useTableSchema';
import { useDispatch, useSelector } from 'react-redux';
import { useTableColumns } from '../../../hooks';
import { getTableDisplayName } from '../../../../DatabaseRelationships';
type LegacyRunQueryContainerProps = {
onRunQuery: (userQuery: UserQuery) => void | null;
@ -73,8 +72,13 @@ export const LegacyRunQueryContainer = ({
) as any;
const limit = curFilter.limit;
const tableColumns = useLegacyTableColumns({ dataSourceName, table });
const tableOperators = useDatabaseOperators({ dataSourceName });
const {
data: {
columns: tableColumns = [],
supportedOperators: tableOperators = [],
} = {},
} = useTableColumns({ dataSourceName, table });
// const tableOperators = useDatabaseOperators({ dataSourceName });
const tableSchema = useTableSchema(table);
const onSubmit = (userQuery: UserQuery) => {
@ -97,7 +101,7 @@ export const LegacyRunQueryContainer = ({
);
};
const tableName = useTableName({ dataSourceName, table });
const tableName = getTableDisplayName(table);
const onExportData = (
type: 'CSV' | 'JSON',
formValues: FiltersAndSortFormValues

View File

@ -1,5 +1,5 @@
import { DEFAULT_STALE_TIME } from '../../DatabaseRelationships';
import { DataSource, Feature } from '../../DataSource';
import { DEFAULT_STALE_TIME } from '../../hasura-metadata-api/useMetadata';
import { Table } from '../../hasura-metadata-types';
import { useHttpClient } from '../../Network';
import { useQuery } from 'react-query';

View File

@ -53,5 +53,6 @@ export function useMetadata(
queryFn,
...queryOptions,
select: d => transformFn(select(d)),
refetchOnWindowFocus: false,
});
}