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

clearStore() and apollo-link-dedup prevent further queries #3792

Closed
blissi opened this issue Aug 8, 2018 · 4 comments · Fixed by #4409
Closed

clearStore() and apollo-link-dedup prevent further queries #3792

blissi opened this issue Aug 8, 2018 · 4 comments · Fixed by #4409

Comments

@blissi
Copy link

blissi commented Aug 8, 2018

Hallo,
I found the following bug that I would consider severe:
when you use clearStore() and apollo-link-dedup, queries may be stuck forever and never be sent anymore.

How to reproduce the issue:
Create a GraphQL backend that delays a query by several seconds. Then, immediately after sending the query, call clearStore(). In the browser console you should see the warning that there are still in-flight requests. Then try send the query again - it won't be sent to the server anymore! The previous result is also never received and this query is stuck forever until you reload the browser tab.

Analysis so far
The cleanup()-method of the dedup-link is never called and therefore the request observable is stored forever in the inFlightRequestObservables-variable. clearStore() cancels all requests and I think that's the reason why the dedup-link isn't subscribed to it anymore.

Versions
apollo-client 2.3.2
apollo-link-dedup 1.0.9

Does anybody have an idea what I could do to prevent this?

@nyanpasu
Copy link

Sounds like a dupe of #3766

@hwillson
Copy link
Member

hwillson commented Sep 5, 2018

This issue is related to #3555, #3766 and #2919. We'll address them all in one shot.

@cheapsteak
Copy link
Member

cheapsteak commented Feb 5, 2019

Has this perhaps been fixed somewhere else?

Having some trouble reproducing this
Here's a codesandbox that follows the reproduction steps:
https://codesandbox.io/s/q39x7kk4xq

It's hooked up to an endpoint that's set to delay a response by 1.5seconds

Without interruption:

With interruption:

@jbaxleyiii
Copy link
Contributor

Thanks for reporting this. There hasn't been any activity here in quite some time, so we'll close this issue for now. If this is still a problem (using a modern version of Apollo Client), please let us know. Thanks!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.