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

Fix ObservableQuery.getCurrentResult() returning cached data with certain fetch policies. #8718

Merged
merged 3 commits into from Aug 27, 2021

Conversation

brainkim
Copy link
Contributor

@brainkim brainkim commented Aug 27, 2021

Fixes #8697

Copy link
Member

@benjamn benjamn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree this will help (backed up by the tests), I have to admit I'm growing uneasy with the complexity/tenuity of this part of the code (getCurrentResult in general)—a situation I brought about and hope to fix in a more general way soon.

src/core/ObservableQuery.ts Outdated Show resolved Hide resolved
src/core/ObservableQuery.ts Outdated Show resolved Hide resolved
@benjamn benjamn added this to the v3.4.x patch releases milestone Aug 27, 2021
@brainkim brainkim merged commit f006376 into main Aug 27, 2021
@brainkim brainkim deleted the brian-network-only branch August 27, 2021 18:42
benjamn added a commit that referenced this pull request Aug 30, 2021
This is a refinement of PR #8718 that prevents reading from the cache
for `network-only`, `no-cache`, and `standby` fetch policies, even when
`lastResult` is truthy.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 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

Successfully merging this pull request may close these issues.

useQuery with fetchPolicy: network-only return cache data at first render when remount component
2 participants