Shared Mutation Results
Hey!
I found PR exposing mutation variables is very exciting!
https://github.com/TanStack/query/pull/4814
Does it mean that we will be able to "pickup" to mutation state in situation as:
1. Component
A1 is mounted, where user calls the mutation
2. Mutation is running, component A1 renders the mutation's state
3. Component A1 is unmounted
4. Component A1 is mounted back and it's able to pickup the mutation, continuing rendering its state1 Reply
ambitious-aqua•3y ago
Not by calling
useMutation again, because that creates a new observer. It's a different architecture compared to queries.
But you can call useMutationState(filters, select) and filter it down to a certain mutationKey to solve your use-case