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

Error when unmounting query while fetchMore is in flight #3466

Closed
doomsower opened this issue May 16, 2018 · 2 comments
Closed

Error when unmounting query while fetchMore is in flight #3466

doomsower opened this issue May 16, 2018 · 2 comments

Comments

@doomsower
Copy link
Contributor

Intended outcome:

No errors are thrown.

Actual outcome:

Apollo-client throws error:

Cannot set property 'networkStatus' of undefined
QueryStore.markQueryResult
    bundle.umd.js:835:16

How to reproduce the issue:

For me it's possible to get stable reproduction in my app by following this steps:

  • Mount component with query, run fetchMore
  • While fetchMore is in flight, unmount component with query
  • Error is thrown

When looking at code that throws, I can see that there's no safeguard on this line:

    if (typeof fetchMoreForQueryId === 'string') {
      this.store[fetchMoreForQueryId].networkStatus = NetworkStatus.ready;
}

However, a few lines above there's a safeguard:

if (!this.store[queryId]) return;

Is it safe to just add another safeguard for fetchMore? If so, I can submit simple PR. However, I don't have enough knowledge to write test for it, if they're required.

Version

  • apollo-client@2.3.1
@doomsower doomsower changed the title Error when unmounting query while doing refetch Error when unmounting query while fetchMore is in flight May 16, 2018
@hwillson
Copy link
Member

PR #3469 has been merged, so this fix will be coming in the next apollo-client release (scheduled for this upcoming Tuesday, 2018-05-29). Thanks!

@FezVrasta
Copy link

For what is worth, I'm getting this error on apollo-client@2.6.0

@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.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants