diff --git a/apps/dashboard/src/hooks/use-create-integration.ts b/apps/dashboard/src/hooks/use-create-integration.ts index 9d2235ae354..494e043fec9 100644 --- a/apps/dashboard/src/hooks/use-create-integration.ts +++ b/apps/dashboard/src/hooks/use-create-integration.ts @@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { useEnvironment } from '../context/environment/hooks'; import { createIntegration } from '../api/integrations'; import { CreateIntegrationData } from '../api/integrations'; +import { QueryKeys } from '../utils/query-keys'; export function useCreateIntegration() { const { currentEnvironment } = useEnvironment(); @@ -10,7 +11,7 @@ export function useCreateIntegration() { return useMutation({ mutationFn: (data: CreateIntegrationData) => createIntegration(data, currentEnvironment!), onSuccess: () => { - queryClient.invalidateQueries({ queryKey: ['integrations'] }); + queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations, currentEnvironment?._id] }); }, }); } diff --git a/apps/dashboard/src/hooks/use-set-primary-integration.ts b/apps/dashboard/src/hooks/use-set-primary-integration.ts index 56d21bf5e18..31314177653 100644 --- a/apps/dashboard/src/hooks/use-set-primary-integration.ts +++ b/apps/dashboard/src/hooks/use-set-primary-integration.ts @@ -16,7 +16,7 @@ export function useSetPrimaryIntegration() { return setAsPrimaryIntegration(integrationId, currentEnvironment!); }, onSuccess: () => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations] }); + queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations, currentEnvironment?._id] }); }, }); } diff --git a/apps/dashboard/src/hooks/use-update-integration.ts b/apps/dashboard/src/hooks/use-update-integration.ts index a2a286b64bd..f62825f33af 100644 --- a/apps/dashboard/src/hooks/use-update-integration.ts +++ b/apps/dashboard/src/hooks/use-update-integration.ts @@ -18,7 +18,7 @@ export function useUpdateIntegration() { return updateIntegration(integrationId, data, currentEnvironment!); }, onSuccess: () => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations] }); + queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations, currentEnvironment?._id] }); }, }); }