Add mutationKey everywhere

This commit is contained in:
Gregory Schier
2024-06-21 09:25:25 -07:00
parent 50e2ab3a03
commit cd9e720835
44 changed files with 67 additions and 26 deletions

View File

@@ -32,6 +32,7 @@ export function useKeyValue<T extends Object | null>({
});
const mutate = useMutation<void, unknown, T>({
mutationKey: ['set_key_value', namespace, key],
mutationFn: (value) => setKeyValue<T>({ namespace, key, value }),
// k/v should be as fast as possible, so optimistically update the cache
onMutate: (value) => queryClient.setQueryData<T>(keyValueQueryKey({ namespace, key }), value),