From b70df06247b39a190625b4a986452c78ae3673c1 Mon Sep 17 00:00:00 2001 From: steveoh Date: Mon, 13 May 2024 20:20:10 -0600 Subject: [PATCH] chore(developer): refetch keys after creation --- src/developer/src/components/page/CreateKey.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/developer/src/components/page/CreateKey.jsx b/src/developer/src/components/page/CreateKey.jsx index 07f29a15..79b10735 100644 --- a/src/developer/src/components/page/CreateKey.jsx +++ b/src/developer/src/components/page/CreateKey.jsx @@ -94,6 +94,7 @@ export function Component() { const loaderData = useLoaderData(); const functions = useFunctions(); const createKey = httpsCallable(functions, 'createKey'); + const getKeys = httpsCallable(functions, 'keys'); const queryClient = useQueryClient(); const { @@ -103,10 +104,13 @@ export function Component() { } = useMutation({ mutationFn: (data) => Spinner.minDelay(createKey(data)), onSuccess: async () => { - await queryClient.cancelQueries(); + await queryClient.cancelQueries({ + queryKey: ['my keys'], + }); - queryClient.invalidateQueries({ - queryKey: ['my keys', loaderData.user.uid], + await queryClient.refetchQueries({ + queryKey: ['my keys'], + queryFn: () => getKeys(), }); }, });