Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pollInterval option only supported on watchQuery error #3395

Closed
jema-turner opened this issue May 3, 2018 · 6 comments
Closed

pollInterval option only supported on watchQuery error #3395

jema-turner opened this issue May 3, 2018 · 6 comments

Comments

@jema-turner
Copy link

jema-turner commented May 3, 2018

Intended outcome:

Fired a query using ApolloClient.query(options) as described in https://www.apollographql.com/docs/react/api/apollo-client.html#ApolloClient.query. I get the error "pollInterval option only supported on watchQuery". If i use watchQuery, adding pollInterval works, but not sure if I need observable queries, plus watchQuery is not well documented (subscribing to observable queries).

Actual outcome:

I get the error "pollInterval option only supported on watchQuery".

How to reproduce the issue:

Query using ApolloClient.query(options) as described in https://www.apollographql.com/docs/react/api/apollo-client.html#ApolloClient.query.

Version

  • apollo-client@
    "apollo-client": "2.2.2"
@hwillson
Copy link
Member

Setting a polling interval is not supported when using ApolloClient.query. It only works with ApolloClient.watchQuery. The docs for this definitely need to be updated. Thanks for pointing this out!

hwillson added a commit that referenced this issue Jun 11, 2018
`ApolloClient.query` is currently configured to accept
`WatchQueryOptions`, which means the docs show people that
passing things like `pollingInterval` into `ApolloClient.query`
is supported (when in reality it's only supported when using
`ApolloClient.watchQuery`). These changes add a new
`QueryOptions` interface, and pull some of the common options
out into a parent `QueryBaseOptions` interface.
`ApolloClient.query` has been updated to use the `QueryOptions`
interface, which should help clear up a bit of confusion.

Fixes #3395.
@hwillson
Copy link
Member

This has been fixed in #3569. Thanks!

@Yatekii
Copy link

Yatekii commented Feb 12, 2022

https://github.com/apollographql/apollo-client/blob/main/src/core/watchQueryOptions.ts#L86

This is still wrong. Also, setting a polling interval on watchQuery is completely useless as it will just poll the cache?!

@ArjunMudhaliyar
Copy link

Is there a technical reason why polling isn't supported in client.query? As pointed out by others, polling using watchQuery will not be of much use.

@SiddHyper
Copy link

@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants