Fix update remote field metadata (#5638)
Closes #5610. & update fetch-policy when fetching database on the remote databases show page to get freshest status.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useQuery } from '@apollo/client';
|
||||
import { useQuery, WatchQueryFetchPolicy } from '@apollo/client';
|
||||
|
||||
import { GET_MANY_REMOTE_TABLES } from '@/databases/graphql/queries/findManyRemoteTables';
|
||||
import { useApolloMetadataClient } from '@/object-metadata/hooks/useApolloMetadataClient';
|
||||
@@ -11,15 +11,19 @@ type UseGetDatabaseConnectionTablesParams = {
|
||||
connectionId: string;
|
||||
skip?: boolean;
|
||||
shouldFetchPendingSchemaUpdates?: boolean;
|
||||
fetchPolicy?: WatchQueryFetchPolicy;
|
||||
};
|
||||
|
||||
export const useGetDatabaseConnectionTables = ({
|
||||
connectionId,
|
||||
skip,
|
||||
shouldFetchPendingSchemaUpdates,
|
||||
fetchPolicy,
|
||||
}: UseGetDatabaseConnectionTablesParams) => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
|
||||
const fetchPolicyOption = fetchPolicy ? { fetchPolicy: fetchPolicy } : {};
|
||||
|
||||
const { data, error } = useQuery<
|
||||
GetManyRemoteTablesQuery,
|
||||
GetManyRemoteTablesQueryVariables
|
||||
@@ -32,6 +36,7 @@ export const useGetDatabaseConnectionTables = ({
|
||||
shouldFetchPendingSchemaUpdates,
|
||||
},
|
||||
},
|
||||
...fetchPolicyOption,
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user