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

Refetching a no-cache query causes the response to be cached #6998

Closed
lee-borsboom opened this issue Sep 10, 2020 · 2 comments
Closed

Refetching a no-cache query causes the response to be cached #6998

lee-borsboom opened this issue Sep 10, 2020 · 2 comments

Comments

@lee-borsboom
Copy link

lee-borsboom commented Sep 10, 2020

Intended outcome:
Refetching a query with a fetchPolicy of no-cache and notifyOnNetworkStatusChange enabled should not result in the response being cached.

Actual outcome:
Refetching a query with fetchPolicy of no-cache and notifyOnNetworkStatusChange enabled causes the response to be cached.

This occurs when using the refetch function provided by the Query component (or output of useQuery hook) and also when using refetchQueries on a mutation.

How to reproduce the issue:
Reproduction is here. Use the Apollo dev tools to inspect the cache before and after clicking the refetch button and observe that after the refetch, the query response is now cached.

https://github.com/lee-borsboom/react-apollo-error-template/tree/refetch_noCache_query

Versions
npx envinfo@latest --preset apollo --clipboard isn't working for me, but I can replicate this on version 3.1.3 and 3.1.4 of Apollo client

@xfournet
Copy link

Same problem here. It's because https://github.com/apollographql/apollo-client/blob/main/src/core/QueryManager.ts#L848
The 'no-cache' case should not be included in the mightUseNetwork boolean ?

@jcreighton
Copy link
Contributor

Resolve with #7761.

@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 a pull request may close this issue.

3 participants