Flag to reuse/share mutation by mutationKey #2294
Replies: 2 comments 2 replies
-
For this specific use-case, there is |
Beta Was this translation helpful? Give feedback.
-
It means my code will looks something like this:
and it's a bit wierd to have I tried to look into code, and unfortunately, this change should be made quite deeply in |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
It would be nice to have some kind of flag/option that allows you to reuse mutations from cache by mutationKey, instead of creating new one.
Imagine a paged list and each item of the list has a button "do something". Users could click button on any number of items, each item should show that "something" is in progress. It's very easy to do, with useMutation hook. But as soon as we change the page of the list, we will lose connection between items and mutations on the previous page.
We could use useQuery hook for that with some modifications to behave like a mutation, but I think useMutation suits for this better.
If I missed something and there is such a thing or you think I should use useQuery in such a case, please let me know.
Beta Was this translation helpful? Give feedback.
All reactions