-
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
fetchPolicy ={'network-only'} in a <Query>/useQuery returns cached values and not remote data #7048
Comments
amineDaouma
changed the title
fetchPolicy ={'network-only'} in a Query component return cached values
fetchPolicy ={'network-only'} in a Query component return cached values and not remote data
Sep 21, 2020
amineDaouma
changed the title
fetchPolicy ={'network-only'} in a Query component return cached values and not remote data
[Apollo Client V3] fetchPolicy ={'network-only'} in a Query component return cached values and not remote data
Sep 21, 2020
amineDaouma
changed the title
[Apollo Client V3] fetchPolicy ={'network-only'} in a Query component return cached values and not remote data
fetchPolicy ={'network-only'} in a <Query>/useQuery returns cached values and not remote data
Sep 23, 2020
I think this might be similar to #7045 (comment)? |
@benjamn Do you have any suggestion please, I'm still stuck with this issue .. Thanks |
Hi all! I believe this was resolved in #7978, please let me know if you experience this with an updated version of the client and we can re-open. Thank you! 🙏🏻 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As a user, I want to cancel changes made on a dashboard like (add or remove a widget from dashboard).
Intended outcome:
When I remove a widget from a dashboard and cancel changes this "removed widget" should be visible again on the dashboard. To do so, I set fetchPolicy to network-only to fetch remote server data and display them on the dashboard
Actual outcome:
A request is made to the server and the data is returned but apollo does not read this remote data . Instead, Apollo Client reads the cached data (read dashboard from the cache instead).
How to reproduce the issue:
Here, when
then :
therefore, Apollo Client makes a request to the server to fetch dashboard data (return to the initial state of dashboard before the made changes on dashboard). The surprise :
result
variable in onCompleted option does not return the server data but only the cached data although the request was made and returns the server data correctly. As if Apollo Client v3 does not allow to display this remote data and only read data from the cache ... I don't know why
Versions
System: OS: Linux 3.10 CentOS Linux 7 (Core) Binaries: Node: 12.18.3 - /usr/local/bin/node Yarn: 1.22.4 - /usr/bin/yarn npm: 6.14.6 - /usr/local/bin/npm
The text was updated successfully, but these errors were encountered: