ItsWendellI
tRPC3y ago
3 replies
ItsWendell

Global metadata / filters: Re-validate all queries

Hi all,

Simple question, I'm looking for the most efficient way to add some global state to all queries, in this case it's a global filter, for this use-case, let's call it testModeFilter. In our dashboard this could be a Context / Provider that manages this state, ideally, when testModeFilter, we want to:

1. invalidate all queries / refetch mounted queries
2. Make sure this global filter / metadata is passed to the server 'somehow'

What's the best approach for this? E.g. I was thinking possibly a cookie, or a header but was wondering if there's other ways to sent global metadata with every query / mutation.
Was this page helpful?