-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
useQuery with fetchPolicy: network-only return cache data at first render when remount component #8697
Labels
Comments
Same here. After upgrading from 3.3 to 3.4 this started happening. I checked that last 3.3.21 version worked as expected. Change behaviour started from 3.4.0 and still occurs in 3.4.9 release. |
Probably caused by this PR #8422 |
brainkim
added a commit
that referenced
this issue
Aug 27, 2021
brainkim
added a commit
that referenced
this issue
Aug 27, 2021
brainkim
added a commit
that referenced
this issue
Aug 27, 2021
brainkim
added a commit
that referenced
this issue
Aug 27, 2021
brainkim
added a commit
that referenced
this issue
Aug 27, 2021
Thanks for the quick fix 🙇 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm trying to use
@apollo/[email protected]
and find out behavior change ofuseQuery
withfetchPolicy: 'network-only'
between AC3.4 and AC3.3, not sure if it's a bug or intended behavior.Intended outcome:
For example we render an
<A />
component, and query withfetchPolicy: 'network-only'
:Then we, unmount
<A />
, and remount<A />
again. e.g. route or state change.I expect when we remount
<A />
, the initialdata
returned byuseQuery
should beundefined
, and after data fetching, the data will be renewed. which is the behavior of AC3.3 .Actual outcome:
When I try the above use case on AC3.4, the initial returned
data
in<A />
on remount will be cache data, notundefined
.How to reproduce the issue:
reproduction: https://codesandbox.io/s/fervent-tesla-sb8oe?file=/src/App.js
Reproduction steps:
<A />
. There's a console.log in useEffect of<A />
to recorddata
value on mount so you can see console printingdata on mount: undefined
.<B />
<A />
. In AC3.4 the console will printing full data, but in AC3.3 (or AC2) it will print undefined.Versions
The text was updated successfully, but these errors were encountered: