-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Apollo isn't caching errors #4806
Comments
I did some more digging through the reported issues, and I think I have found a related issue #4644. This appears to be a pretty critical bug, especially since the documentation specifically states that it should be caching both data and errors. |
Please open a feature request for this in https://github.com/apollographql/apollo-feature-requests. Thanks! |
I just want to make sure I understand this correctly. Are you saying the documentation is incorrect when it says
If that's true, then I guess I agree that this should be a feature request. But if not, this is clearly a bug that should be fixed because the errors are not saved to the cache. |
@KevinHewson the above used to be technically accurate, but is unfortunately a bit misleading. When people read this they think that errors are saved into the in-memory based normalized cache itself, as in what you see if you dump out |
Errors are saved in memory for use by an application's UI, but they are not stored in the actual cache itself. The original wording here leads people to believe they are, so this PR tweaks the wording a bit. Related to: #4806
After navigating in my React app, I'm noticing that the errors that occurred after a successful query are not getting cached.
I'm using
errorPolicy: "all"
. According to the documentation here, I would expect that it"saves both data and errors into the Apollo Cache"
Intended outcome
When GraphQL returns
I would expect Apollo to cache both data and errors.
Actual outcome
Apollo will pull
data
from the cache, but not errors.error
ends up being undefined.How to reproduce the issue
Create a query that results in an error and data. Navigate away from component and then back and notice that the data will get pulled from cache, but errors will not.
Version
apollo-client
version2.5.1
react-apollo
version2.5.2
The text was updated successfully, but these errors were encountered: