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

resetStore causes queries with notifyOnNetworkStatusChange to return undefined #7138

Closed
joshjg opened this issue Oct 8, 2020 · 4 comments · Fixed by #7150
Closed

resetStore causes queries with notifyOnNetworkStatusChange to return undefined #7138

joshjg opened this issue Oct 8, 2020 · 4 comments · Fixed by #7150

Comments

@joshjg
Copy link
Contributor

joshjg commented Oct 8, 2020

Intended outcome:
Calling client.resetStore should properly update all watched queries, even if they have notifyOnNetworkStatusChange: true

Actual outcome:
result.data is undefined for queries that set notifyOnNetworkStatusChange: true after calling client.resetStore

How to reproduce the issue:

Versions
@apollo/client - 3.2.2
graphql - 14.7.0

Also tried with 3.3.0-beta.10 - same issue.

@lucas-calzolari-toptal
Copy link

I am having a hard time with the same issue.

@lucas-calzolari-toptal
Copy link

Adding some info from my specific case, it seems like for the issue to happen, besides having notifyOnNetworkStatusChange = true, you also need the query before and after reset store to return the same value.

If I reset store adding an authentication and get a different result, it works correctly even with notifyOnNetworkStatusChange as true.

@joshjg
Copy link
Contributor Author

joshjg commented Oct 11, 2020

Looking back through the version history for v3, it looks like it broke between 3.0.0-rc.4 and 3.0.0-rc5. And combined with @lucas-calzolari-toptal 's observation above it looks like this is probably the culprit: 0962d25

@benjamn
Copy link
Member

benjamn commented Oct 13, 2020

This should be fixed in @apollo/client@3.2.4, thanks to #7150.

@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