apollographql / apollo-client

:rocket:  A fully-featured, production ready caching GraphQL client for every UI framework and GraphQL server.
https://apollographql.com/client
MIT License
19.38k stars 2.66k forks source link

Polling does not stop after unmounting query #11750

Closed dylanwulf closed 6 months ago

dylanwulf commented 7 months ago

Issue Description

When I mount a polling query and then later unmount it, I would expect the polling to stop. But instead the polling seems to continue.

Link to Reproduction

https://github.com/dylanwulf/react-apollo-error-template/tree/polling-doesnt-stop

Reproduction Steps

@apollo/client version

tried 3.7.12 & 3.9.9, problem exists in both

jerelmiller commented 7 months ago

Thanks for the report @dylanwulf! We've got 3.10 in rc that we'll be releasing next week. We'll see if we can take a look at this sometime after that goes out 🙂

jerelmiller commented 6 months ago

Hey @dylanwulf 👋

I've got a fix for this issue in #11837. Thanks so much for your reproduction which helped me narrow down the issue here!

I can confirm that installing the snapshot release fixes this issue. If you'd like to try it yourself, you can install it with the following command:

npm i @apollo/client@0.0.0-pr-11837-20240509172621

We should be able to get this out with the next patch release.

github-actions[bot] commented 6 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

github-actions[bot] commented 5 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. For general questions, we recommend using StackOverflow or our discord server.