Errors lost on cached results
See original GitHub issueI’m using apollo and react to call a query that returns mixed results: error(s) and some data.
In order to handle the errors, but still be able to use the information given, I’m using the errorPolicy: "all"
option in the query.
<Query query={query} variables={variables as any} errorPolicy='all'>
{({loading, error, data}) => { ... }}
</Query>
The first time I mount the component data is populated with the partial informations and error with the errors returned by the query. If I change the route (unmounting the component) and then return on it, it shows the cached partial data but no errors, so I’m not able to handle errors anymore and detect that these are partial informations.
Intended outcome: The component shows me the original errors along with the cached data.
Actual outcome: The props error is undefined, the partial data are passed as if the query didn’t return any error.
How to reproduce the issue: Create a query that returns both data and error.
Version
"react-apollo": "2.5.2",
"apollo-client": "^2.5.1",
Reference to docs:
From the docs ^^^^^
https://www.apollographql.com/docs/react/features/error-handling
If this issue looks familiar thats because i stole part of the description from here. An issue that was previously opened and then closed.
Im not sure why that issue was closed as a solution to the original issue was never found.
Note: I am NOT using SSR, i’m simply using the in meme cache.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:23 (6 by maintainers)
Top GitHub Comments
Can we expect this to be fixed by the Apollo team? Are there any workarounds for hook-based queries?
Ping @hwillson any updates here?