Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

reload vault store after fdw create/delete

Alaister Young62c4d2f9bd5c
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<UseMutationOptions<FDWCreateData, unknown, FDWCreateVariables>, 'mutationFn'> = {}) => {
const queryClient = useQueryClient()
+ const { vault } = useStore()
return useMutation<FDWCreateData, unknown, FDWCreateVariables>((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<UseMutationOptions<FDWDeleteData, unknown, FDWDeleteVariables>, 'mutationFn'> = {}) => {
const queryClient = useQueryClient()
+ const { vault } = useStore()
return useMutation<FDWDeleteData, unknown, FDWDeleteVariables>((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)
},