Trigger refetch/rerender after setDefaultOptions
I would like to trigger a refetch of all queries when the workpace variable changes. Workspace is being passed in most api's as a custom header and fed into the api via react-queries
meta
object.
The problem is that refetchQueries() does not have the updated meta
object when refetching.2 Replies
afraid-scarlet•12mo ago
I think your better off placing
workspace
into the queryKeys
of the queries that need it, like ['queryId, workspace, ...otherOptions]
. Would be annoying if it's like every query, might be worth making a factory function. I'm not sure of another way to do it if it's a truly global depenency.
How is workspace updated? It would be better for that code to be in the event callback when workspace is changed.sharp-indigo•12mo ago
This, im doing this as well, i just pass a client_uuid into all my queries.