-
Notifications
You must be signed in to change notification settings - Fork 7
Description
I am using Apollo client v4.0.6 with node 20.15.1
The problem I am facing is that when executing a deferred query, the query will stop if there are any GraphQL errors on any field. So if one field errors, the entire query is stopped and not cached. This is fixed by using errorPolicy: 'all'
or errorPolicy: 'ignore'
in the useQuery()
options; however, now when there are errors, the result of the query will still be cached.
I'm looking for some kind of feature so that I can continue streaming the query until completed upon encountering a GraphQL error but have the final result NOT be cached. I only want my query to be cached when it has completed without any errors. I could not find any docs thats could help when calling InMemoryCache()
, ApolloClient()
, or useQuery()
My initial thought is an additional error policy similar to all
that does not cache on errors
https://www.apollographql.com/docs/react/data/error-handling#graphql-error-policies