mellson
Full cache invalidation and timing problem
I'm really enjoying using the full cache invalidation https://trpc.io/docs/reactjs/usecontext#invalidate-full-cache-on-every-mutation
But I'm debugging some timing issues around the
onSuccess
call. And I'm not sure which onSuccess
call is meant to be called by the await opts.originalFn()
in the following snippet. It says it will call the onSuccess
defined in the useQuery
call. I naively maybe thought it would call the onSuccess
defined in the useMutation
. But when I try to do some simple console logging, I can't figure out the timing of these calls. Both the originalFn
and invalidateQueries
calls get fired before any of my onSuccess
calls. So it has left me a little confused 🤔
TL;DR; Where do I define the opts.originalFn()
getting called here?
10 replies