T
TanStack2y ago
passive-yellow

Is there any way to identify what are the parameters for the currently running mutation?

Is there any way to identify what the parameters for the currently running mutation are with useMutation? I am mapping over a list, where each item has a button that performs the same action with a different parameter. I am trying to show a loading indicator in the correct place. (I could move the list items to a child element and call the mutation from there but I'd rather not if possible)
1 Reply
afraid-scarlet
afraid-scarlet2y ago
useMutationState | TanStack Query Docs
useMutationState is a hook that gives you access to all mutations in the MutationCache. You can pass filters to it to narrow down your mutations, and select to transform the mutation state. Example 1: Get all variables of all running mutations

Did you find this page helpful?