diff --git a/studio/data/fdw/fdw-create-mutation.ts b/studio/data/fdw/fdw-create-mutation.ts index c85e82941d4..f42a81f2d4d 100644 --- a/studio/data/fdw/fdw-create-mutation.ts +++ b/studio/data/fdw/fdw-create-mutation.ts @@ -2,6 +2,7 @@ import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react import { AvailableColumn, Wrapper } from 'components/interfaces/Database/Wrappers/Wrappers.types' import { executeSql } from 'data/sql/execute-sql-query' import { sqlKeys } from 'data/sql/keys' +import { useStore } from 'hooks' export type FDWCreateVariables = { projectRef?: string @@ -150,12 +151,16 @@ export const useFDWCreateMutation = ({ ...options }: Omit, 'mutationFn'> = {}) => { const queryClient = useQueryClient() + const { vault } = useStore() return useMutation((vars) => createFDW(vars), { async onSuccess(data, variables, context) { const { projectRef } = variables - await queryClient.invalidateQueries(sqlKeys.query(projectRef, ['fdws'])) + await Promise.all([ + queryClient.invalidateQueries(sqlKeys.query(projectRef, ['fdws'])), + vault.load(), + ]) await onSuccess?.(data, variables, context) }, diff --git a/studio/data/fdw/fdw-delete-mutation.ts b/studio/data/fdw/fdw-delete-mutation.ts index c387d213173..8ecc603a853 100644 --- a/studio/data/fdw/fdw-delete-mutation.ts +++ b/studio/data/fdw/fdw-delete-mutation.ts @@ -2,6 +2,7 @@ import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react import { Wrapper } from 'components/interfaces/Database/Wrappers/Wrappers.types' import { executeSql } from 'data/sql/execute-sql-query' import { sqlKeys } from 'data/sql/keys' +import { useStore } from 'hooks' export type FDWDeleteVariables = { projectRef?: string @@ -56,12 +57,16 @@ export const useFDWDeleteMutation = ({ ...options }: Omit, 'mutationFn'> = {}) => { const queryClient = useQueryClient() + const { vault } = useStore() return useMutation((vars) => deleteFDW(vars), { async onSuccess(data, variables, context) { const { projectRef } = variables - await queryClient.invalidateQueries(sqlKeys.query(projectRef, ['fdws'])) + await Promise.all([ + queryClient.invalidateQueries(sqlKeys.query(projectRef, ['fdws'])), + vault.load(), + ]) await onSuccess?.(data, variables, context) },