Callback on pause of any mutation or query #5048
-
My desired offline implementation is
Having achieved the first aspect using conditional rendering on pause and no data, I'm looking for something like a global I already thought about adding a global request wrapper that checks I'd appreciate any help! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I think one way to do this in user-land is to setup a global subscription to the QueryCache, then act on the passed
|
Beta Was this translation helpful? Give feedback.
-
For those that land here and want to do this with the V5 with mutations for example: useEffect(() => {
return queryClient.getMutationCache().subscribe((event) => {
if (event.mutation?.state.isPaused) {
showToast()
}
});
}, [queryClient]); |
Beta Was this translation helpful? Give feedback.
I think one way to do this in user-land is to setup a global subscription to the QueryCache, then act on the passed
action
: