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

useLazyQuery polling? #5140

Closed
Tracked by #8596
zebbedi opened this issue Aug 7, 2019 · 9 comments
Closed
Tracked by #8596

useLazyQuery polling? #5140

zebbedi opened this issue Aug 7, 2019 · 9 comments

Comments

@zebbedi
Copy link

zebbedi commented Aug 7, 2019

Just trying out the new useLazyQuery hook and the documentation and the TS seem to suggest that it supports polling, however I can't seem to make it work.

Can someone confirm if it does indeed support polling?

@hwillson
Copy link
Member

hwillson commented Aug 7, 2019

@zebbedi Polling should work; it doesn't start until after your first call to the execute function. If it isn't working, then that's a bug. Any chance you could put together a small reproduction that shows the issue?

@zebbedi
Copy link
Author

zebbedi commented Aug 7, 2019

Apologies i think we may have jumped the gun.

I think the thing that tripped us up was that we replaced a useQuery which had a 'skip: true' for initial load. With this the startPolling function is available immediately. When we swapped it out for a useLazyQuery the startPolling function is undefined and then becomes available only after the result of the first execution.

Not sure if that's still a consistency issue or expected?

@hwillson
Copy link
Member

Interesting @zebbedi - that does't sound intended. I'll take a look - thanks!

@masad-frost
Copy link

I have a PR here since October apollographql/react-apollo#3645, I can move it to https://github.com/apollographql/apollo-client/ if there's interest.

@sanpablomarket
Copy link

this appears to still be broken. startPolling and stopPolling are undefined when returned from the lazy hook.

@Badbreaddead
Copy link

If anybody stumbles upon this: you can call initialQuery and then call startPolling

@hwillson hwillson removed their assignment Apr 28, 2021
@arieller
Copy link

so basically subscribeToMore and polling is broken? :( :((((((((((((

@bcheidemann
Copy link

Which version do I need to upgrade to in order to get the fix for this?

@simoleone
Copy link

@bcheidemann v3.5.0 and up, which was released in November 2021

image

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 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

9 participants