T
TanStack3y ago
distinguished-blush

MutationKey null when using persistQueryClient

Hi, I am using persistQueryClient for caching mutations and queries when the user is offline. It works well for queries, but not for mutations. When using the custom hook useCreateTodo, I am getting a mutationKey of [null]. However, if I import the useMutation hook and use it like this: useMutation({mutationKey:['create-todo']}), it works when I restarts the app. I already have a mutationDefaults
queryClient.setMutationDefaults(['create-todo'], {
mutationFn: createTodo
});
queryClient.setMutationDefaults(['create-todo'], {
mutationFn: createTodo
});
1 Reply
ratty-blush
ratty-blush3y ago
hm, I'd need to see an example. We have one in the docs and that works fine ...

Did you find this page helpful?