question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Move refetch(), startPolling() and stopPolling() from Subscription to ObservableQuery

See original GitHub issue

Interoperability 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:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stubailocommented, Jun 29, 2016

@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.

0reactions
kamilkisielacommented, Jul 20, 2016
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found