Is it possible to combine filters for different mutations in useIsMutating hook #3426
-
|
I have various mutations across many different states and I wanted to utilize the useIsMutating with the specific mutation keys to know exactly when the needed mutation is in the mutating state. At the moment the only way I could make it work is the following: Is it possible to combine all those useIsMutating with one function call? I tried the following setups and none of them worked for me so far: Would be great to know if there is a way to make it happens somehow as none of the three variants above worked for me and all of them are always returning 0. If this is a valid idea and there is no implementation I would love to contribute and make a PR for this feature. Please advice :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
you can try with |
Beta Was this translation helpful? Give feedback.
you can try
useIsMutating({ predicate: (mutation) => mutation.key === ... || mutation.key === ... })with
predicate, you can return true or false for every matching mutation. If your keys are known and you don't need fuzzy matching of keys, you should be able to combine them.