Skip to content

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

Closed
@martijnwalraven

Description

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();

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions