question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetchMore leaks watched queries

See original GitHub issue

I’m using fetchMore on an ObservableQuery that I’m already subscribed to. I’m not starting any new watchQueries. However, the Apollo Chrome inspector shows that each time I use fetchMore to fetch another page of results, a new “watched query” appears in the list. These remain even after I unsubscribe from my original subscription. Is this expected? Is there something else I need to do to clean up old watchQueries when using fetchMore?

This is all happening in ember-apollo-client, so it’s entirely possible there’s a bug or behavior in that integration specific to fetchMore because this is the first time I’m trying to use it. Digging through react-apollo though I couldn’t find anything specific to deal with this sort of thing. And there doesn’t appear to be any documentation describing the behavior I’m seeing.

Side note: I am the maintainer of ember-apollo-client, so I’m quite interested in understanding and fixing this issue.

Intended outcome:

Use fetchMore to load the next page of results. Expected that the “watched queries” list does not grow because I’m not actually starting a new query or making a new subscription to an ObservableQuery.

Actual outcome:

The Apollo Chrome inspector shows that each time I use fetchMore to fetch another page of results, a new “watched query” appears in the list. These remain even after I unsubscribe from my original subscription (i.e. when I change routes, all of them stick around except one).

pagination-watched-queries

Is this expected? Is there something else I need to do to clean up old watchQueries when using fetchMore?

How to reproduce the issue:

Watch the Apollo Chrome inspector’s “watched queries” list while you use fetchMore in any app that does so.

Version

  • apollo-client@1.9.3

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:16 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
chris08002commented, Dec 5, 2017

The issue is still the same. We went through the hassle of installing 2.0 and the problem continues. We have build some workaround now but it is not a real solution.

1reaction
raysuelzercommented, Mar 15, 2018

Is there any update on this? It’s a pretty yucky leak.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Core pagination API - Apollo GraphQL Docs
The fetchMore function. Pagination always involves sending followup queries to your GraphQL server to obtain additional pages of results. In Apollo Client, the ......
Read more >
FetchMore not updating data with queryroot - Stack Overflow
Earlier, I was using a query to read-only products based on some filters, and fetchmore() was working fine but now I'm using queryroot...
Read more >
Ember-apollo-client-fixed NPM | npm.io
As such, we've solved real-world problems such as reliable testing and preventing resource leaks by unsubscribing from watch queries.
Read more >
ember-apollo-client - npm
... such as reliable testing and preventing resource leaks by unsubscribing from watch queries. ... fetchMore(. ... Unsubscribing from watch queries.
Read more >
@apollo/client | Yarn - Package Manager
watch memory leak. ... Consider cache.reset a destructive method, like cache.evict and cache.modify . ... Avoid refetching observerless queries with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found