Move refetch(), startPolling() and stopPolling() from Subscription to ObservableQuery
See original GitHub issueInteroperability with other Observable implementations (see #149) means we have no control over the Subscription object users end up with.
For example, Rx.Observable.from(handle).subscribe()
would return an RxJS Subscription object without the Apollo-specific helper methods.
So I think it makes most sense to move these methods to ObservableQuery
(maybe this needs a better name, like QueryHandle
or simply Query
).
This will require some refactoring of the current code to share fetching and polling logic between observers, but that actually seems like a better design anyway.
const handle = queryManager.watchQuery({ query });
handle.refetch();
handle.startPolling();
handle.stopPolling();
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:5 (5 by maintainers)
Top Results From Across the Web
ObservableQuery - Apollo GraphQL Docs
Update the variables of this observable query, and fetch the new results if they've changed. If you want to force new results, use...
Read more >Apollo Quirks: Polling After Refetching with New Variables
This GitHub issue on the apollo-client project suggests calling stopPolling before changing the query's variables, and startPolling to re-enable ...
Read more >api documentation for apollo-client (v1.0.4)
ObservableQuery.prototype.startPolling (pollInterval); function apollo-client.ObservableQuery.prototype.stopPolling (); function apollo-client.
Read more >ObservableQuery - Client (React) - Apollo GraphQL Docs
Update the variables of this observable query, and fetch the new results. ... startPolling(pollInterval): any ... stopPolling(): any.
Read more >How to refetch a query when a new subscription arrives in ...
To solve the problem, we need to move the subscription logic out of render ... Component { componentDidMount() { const { data: {...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Urigo, @kamilkisiela I think we should fix this ASAP. I was just talking to @purban and it’s a bit weird because people from Angular 2 are going to be expecting RxJS, not a regular old observable. With this merged, at least we can implement a feature to replace the observable shim with Rx.
#430