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

Old query gets re-fetched after another one calls.. But old component is already unmounted.. #6644

Closed
damikun opened this issue Jul 19, 2020 · 4 comments

Comments

@damikun
Copy link

damikun commented Jul 19, 2020

I`m using Apollo client v3 and i did migration from prev version now im having strange behavior...

Intended outcome:
One Query Hook cannot affect another Query hook (in separate component) which is not mounted..

Actual outcome:
I have 2 query's in 2 different components (displayed as tabs )

"GetUserOverviewData" (Query 1 in Component 1) and "GetUserSettingsData" (Query 2 in Component 2) they have some equal fields inside...

When i call refetch or fetchmore on GetUserSettingsData the additional fetch for GetUserOverviewData is called... but this component where hook is, is not loaded... client make this fetch and i have no idea why?

The react adds error message that im trying to process update on unmounted component... Component is unmounted i tested this by simple UseEffect.. Looks like some observable is not unregistered..

Fetchpolicy is set to "cache-and-network", to have new data on each new component root render..

In old Apollo all was working well is there some new change to this ?

Versions:
"@apollo/client": "^3.0.2",
"graphql-tag": "^2.10.4",
"react": "^16.13.1",

Edited:

I found similar issues (just for info)
#6634
apollographql/react-apollo#4044
apollographql/react-apollo#4000

@damikun damikun changed the title Old query gets re fetched after another one calls.. But old component is already unmounted.. Old query gets re-fetched after another one calls.. But old component is already unmounted.. Jul 19, 2020
@dylanwulf
Copy link
Contributor

Hello! If you could provide a runnable reproduction, that would help a lot in getting your issue fixed. The information provided so far is not quite enough to find the problem.

@damikun
Copy link
Author

damikun commented Jul 20, 2020

Hmm I just found this issue behavior looks similar to many others so i will just provide links for now..

#6634
apollographql/react-apollo#4044
apollographql/react-apollo#4000

@hwillson
Copy link
Member

hwillson commented May 4, 2021

Let us know if this is still a concern with @apollo/client@latest - thanks!

@hwillson hwillson closed this as completed May 4, 2021
@0-don
Copy link

0-don commented Apr 16, 2022

same problem while using react native using lazyquery fetching data on search and fetchmore on scroll, after switching to details old search query retriggers

I have an example here

@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

No branches or pull requests

4 participants