Comments (3)
It actually seems to be pretty trivial, it seems it's possible to pass errorPolicy
(and maybe fetchPolicy
too) here
apollo-client/src/core/ObservableQuery.ts
Line 570 in 8bc7d4d
from apollo-client.
Hey @skolodyazhnyy 👋
You're right, seems like we should be able to forward those options along to startGraphQLSubscription
. I think this is likely a good change.
I'm also wondering if it would make sense to default those values to the same as the query itself. For example, if you set errorPolicy
to all
in your query, perhaps subscribeToMore
should also default to this value. What are your thoughts on that?
I'll take this to our next team meeting as well to discuss this idea to make sure I'm not thinking of this the wrong way. We'll be releasing 3.10 this week so no guarantees on a timeline here, but we will likely try and look at this for a 3.10.x patch release. Thanks again for the report!
from apollo-client.
Thanks @jerelmiller.
I think inheriting values makes sense, subscription queries are normally follow same "logic" as their main query. If developer already wrote error handling logic for main query it will work for follow up updates.
Another thing to keep in mind, is making sure errors can be handled in a convinient way.
I think they probably should be available in the updateQuery
as you may want to modify how update is merged with original query depending on what errors you are getting.
I'm not sure if onError
should be called, I think it will be backwards incompatible change as current call to onError
means "subscription is over".
And, since I have you here, it would have been nice to add onComplete
option to subscribeToMore
so I can get notified when subscription has completed successfully :)
from apollo-client.
Related Issues (20)
- When using `useReadQuery` directly before `useQueryRefHandlers`, `refetch` won't update the `useReadQuery` result HOT 2
- [Testing utilities] Docs HOT 2
- [Testing utilities] Call `createMockSchema` from within `createTestSchema` HOT 3
- [Testing utilities] Create separate entrypoint for new testing utilities HOT 4
- `MockLink` doesn't work with `@nonreactive` directive. HOT 2
- [Tests] Investigate flaky test in `src/link/persisted-queries/__tests__/persisted-queries.test.ts`
- `useFragment` doesn't respect the `@nonreactive` directive HOT 2
- `ApolloError.graphQLErrors` are not of type `GraphQLError` HOT 2
- AutoCleanedWeakCache causes failure when running tests in fakeAsync zone HOT 4
- useQuery fails to resolve ssr renderPromise due to JSON.stringify reordering HOT 6
- useSuspenseQuery returns an error instead of throwing an exception HOT 6
- Initializing ApolloClient before DataDog RUM causes GraphQL calls to not have the correct headers HOT 5
- Skipped Query returns outdated data after cache clearing HOT 7
- Merge function at the type level not working (+ suggested fix) HOT 13
- Unexpected Data Fetching with `useBackgroundQuery`, StrictMode, `fetchPolicy`: `network-only` (or `no-cache`), and state changes HOT 6
- When use the Apollo Client server side rendering, How to share the cache in cluster server (k8s)? ( did we have file cache? or db cache? ) HOT 3
- Feedback for schema-driven testing utilities HOT 1
- Add `subscribeToMore` functionality to `useQueryRefHandlers`, `useBackgroundQuery`
- [Docs] Anchor links seem to be stripped HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-client.