When an app has a global store value that changes the context of all requests, it would be useful to be able to add the variable as an additional queryKey to all requests. This way, react-query will notice the change and automatically refetch due to the global queryKey changing.
It would be convenient to be able to set a globalQueryKeys
property when configuring createClient
.
Currently, I am changing the context by passing the global store value as a header when configuring createClient
. This works partially as react-query will refetch the proper data when the window is blurred and then refocused. However, react-query will not refetch the correct data when manually invalidating queries and calling queryClient.resetQueries()
. I'm thinking if the value was also set as a global queryKey, the refetching might be more intuitive and automatic.
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too