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 fails to *complete* with fetchPolicy set to no-cache or 'network-only' #6428

Closed
riccoski opened this issue Jun 11, 2020 · 3 comments

Comments

@riccoski
Copy link

useLazyQuery fails to complete with fetchPolicy set to no-cache or 'network-only'.
However it works when it's set to 'cache-first'

Intended outcome:
When executing the query in useLazy query 'loading' should become false and 'onCompleted' function should be fired once data/response has been received.

Actual outcome:
'loading' remains true and 'onCompleted' never gets called.

How to reproduce the issue:
https://codesandbox.io/s/quiet-sea-hj7es?file=/src/App.js

When you click 'Get data' the loading state persists and the onCompleted doesn't fire.

Versions
System:
OS: macOS 10.15.4
Binaries:
Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
Browsers:
Chrome: 83.0.4103.97
Edge: 83.0.478.45
Firefox: 72.0.2
Safari: 13.1
npmPackages:
@apollo/client: ^3.0.0-rc.3 => 3.0.0-rc.3
@apollo/link-context: ^2.0.0-beta.3 => 2.0.0-beta.3
@apollo/link-error: ^2.0.0-beta.3 => 2.0.0-beta.3
apollo-cache-persist: ^0.1.1 => 0.1.1

@irishbryan
Copy link

useLazyQuery fails to complete with fetchPolicy set to no-cache or 'network-only'.

👍 Experiencing something similar for fetchPolicy: "cache-and-network" when applied to a useLazyQuery hook. Query never completes but works as expected when I remove fetchPolicy. Problem appeared after upgrading from ^3.0.0-beta.19 => 3.0.0-rc.4

Versions:
System:
OS: macOS 10.15.4
Binaries:
Node: 14.2.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm
Browsers:
Chrome: 83.0.4103.97
Firefox: 76.0.1
Safari: 13.1
npmPackages:
@apollo/client: ^3.0.0-beta.19 => 3.0.0-rc.4
apollo-link: ^1.2.14 => 1.2.14
apollo-link-batch-http: ^1.2.14 => 1.2.14
apollo-link-error: ^1.1.13 => 1.1.13

@itshallrun
Copy link

Duplicate of #6301 & #6346

@riccoski
Copy link
Author

#6301

I agree - believe it's the same issue. Thanks

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

No branches or pull requests

3 participants