Skip to content

Commit

Permalink
fix: query keys
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Dec 16, 2024
1 parent ad7b420 commit 1a0eff0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/dashboard/src/hooks/use-create-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -10,7 +11,7 @@ export function useCreateIntegration() {
return useMutation<unknown, unknown, CreateIntegrationData>({
mutationFn: (data: CreateIntegrationData) => createIntegration(data, currentEnvironment!),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['integrations'] });
queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations, currentEnvironment?._id] });
},
});
}
2 changes: 1 addition & 1 deletion apps/dashboard/src/hooks/use-set-primary-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function useSetPrimaryIntegration() {
return setAsPrimaryIntegration(integrationId, currentEnvironment!);
},
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations] });
queryClient.invalidateQueries({ queryKey: [QueryKeys.fetchIntegrations, currentEnvironment?._id] });
},
});
}
2 changes: 1 addition & 1 deletion apps/dashboard/src/hooks/use-update-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] });
},
});
}

0 comments on commit 1a0eff0

Please sign in to comment.