Is there a way to reset mutations based on key?
My apologies - this is a duplicate of react-query-questionsCan I reset all mutation state similar to how I can clear all queries based on key? but that didn't have an answer. I am pretty sure I have a legit use case for this: I have a hook that keeps track of pending & successful mutations:
I can then use this hook to filter out items from a list elsewhere.
Sometimes, I want to remove an ID from this list. Is there a way to reset a mutation, like how you can do
If you're interested, the mutation is here - it's for leaving a DM conversation: https://github.com/bluesky-social/social-app/blob/main/src/state/queries/messages/leave-conversation.ts
and I want to reset it when a new conversation begins, here: https://github.com/bluesky-social/social-app/blob/main/src/state/queries/messages/list-conversations.tsx#L105
Many thanks!
I can then use this hook to filter out items from a list elsewhere.
Sometimes, I want to remove an ID from this list. Is there a way to reset a mutation, like how you can do
queryClient.resetQueries({ queryKey: your_key_here })? I can't use the reset function returned by the hook, because I don't know what the ID is in advance.If you're interested, the mutation is here - it's for leaving a DM conversation: https://github.com/bluesky-social/social-app/blob/main/src/state/queries/messages/leave-conversation.ts
and I want to reset it when a new conversation begins, here: https://github.com/bluesky-social/social-app/blob/main/src/state/queries/messages/list-conversations.tsx#L105
Many thanks!