You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
I'm trying to handle error cases when a query variables mutates. My problem is with the error object on query's children function which is not reset when cache is read.
I have a Query component executing a query with a sort order variable. Something like:
The ReviewSortOrder type is either ASC or DESC but right now only ASC is implemented and running the query with DESC returns an error from server.
Here is how my code executes:
Default order is ASC: the query fires and gets a positive response. Query's children function is called with the data and no error object.
User changes order via UI to DESC: the query fires again and gets an error response. Query's children function is called with an error object.
User changes back to ASC: the query does not fire because the cache is used. Query's children function is called with the previous error object.
Intended outcome:
I'd expect the last call to children to not include the error object.
Actual outcome:
The last call to children contains the error object from the previous execution
How to reproduce the issue:
I don't have a reproduction repo or sandbox, sorry. My Query is configured with fetchPolicy at cache-first and notifyOnNetworkStatusChange at true, other props use their default values.
Version
apollo-client@2.2.8
react-apollo@2.1.3
Many thanks for your help
The text was updated successfully, but these errors were encountered:
I'm trying to handle error cases when a query variables mutates. My problem is with the error object on query's children function which is not reset when cache is read.
I have a Query component executing a query with a sort order variable. Something like:
The ReviewSortOrder type is either
ASC
orDESC
but right now onlyASC
is implemented and running the query withDESC
returns an error from server.Here is how my code executes:
ASC
: the query fires and gets a positive response. Query's children function is called with the data and no error object.DESC
: the query fires again and gets an error response. Query's children function is called with an error object.ASC
: the query does not fire because the cache is used. Query's children function is called with the previous error object.Intended outcome:
I'd expect the last call to children to not include the error object.
Actual outcome:
The last call to children contains the error object from the previous execution
How to reproduce the issue:
I don't have a reproduction repo or sandbox, sorry. My Query is configured with
fetchPolicy
atcache-first
andnotifyOnNetworkStatusChange
attrue
, other props use their default values.Version
Many thanks for your help
The text was updated successfully, but these errors were encountered: