I’m wondering if there’s a way to get determine if any mutations are occuring like in TanStack Query’s useIsMutating
hook. We have few places where getting the status is challenging due to it being a child and a parent indicator needs to show something is occuring.
Anyone encountered or built something like this?
Hey @ericchernuka 
Unfortunately Apollo Client does not have anything like this that is global. There is a loading
property returned from useMutation
so you could use that to synchronize with the parent, but not the most ideal.
There are some internals that track mutation state for use with the Apollo Client Devtools, but I’m hesitant to recommend using those since they are private properties and are subject to change as we need to adjust for the devtools.
I’m sorry I don’t have a better suggestion!
Darn. Ok. Ya, Tanstack Query spoiled me with all the little helpers so I’m just trying to recreate some of those to ease some of these problems without introducing a useState that I have to sync.
Hi @ericchernuka
A possible solution is to create an Apollo Link to check if any mutation is running and use Apollo Reactive Var (makeVar
and useReactiveVar
) to store and access the data
1 Like
Oh good idea. I had a similar one with zustand, but this could work as it’s integrated into the lib. I’ll take a look!