-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache invalidate based on headers #1904
Comments
Hmm, if you can derive that from the response, you can add some kind of Pull Requests in that direction would be very welcome - at the moment I don't have the time to do a lot on RTK. |
I just submitted a PR to pass |
The This should be possible now. |
For RTK Query
Currently the cache key takes only the query args into consideration for deciding validation of cache.
We have an endpoint
getPosts
and in the headers of this GET request we are sending the JWT token of the user. The response is different based on whether the token is present or not. We useprepareHeaders
to set the token in requests instead of sending it as arg in every request.But with current setup the
getPosts
will not refetch data from server if the token in Header changes. Is there any way / workaround to achieve this?The text was updated successfully, but these errors were encountered: