simonsimcity
simonsimcity
TtRPC
Created by simonsimcity on 4/9/2025 in #❓-help
Query invalidation per mutation-key
I just learned about query invalidation using the classic implementation, and that it provides an option to invalidate all queries on every mutation (https://trpc.io/docs/client/react/useUtils#invalidate-full-cache-on-every-mutation). I haven't followed up on the possibilities the new TanStack React Query provides, but I was just about asking whether it's possible to also get the key of the mutation in the general function. I would like to have some central place, where I register that every mutation on key X should invalidate query Y and Z. I would like to skip having to remember this every time I write a mutation, but I still want to be more specific that just reloading everything on a mutation. Hope my request is understandable 😅 I'm myself just getting warm with this lib, but I like it a lot already ♥️
2 replies