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

Additional check for this.store to prevent undefined error at this.store[o].networkStatus=t.NetworkStatus.ready #3914

Merged
merged 4 commits into from
Sep 19, 2018

Conversation

i6mi6
Copy link
Contributor

@i6mi6 i6mi6 commented Sep 13, 2018

This check is necessary, because sometimes a component gets mounted, request is fired, then the component gets unmounted (perhaps by user) and this.store becomes undefined, which causes the request handling to fail at this.store[queryId].networkStatus = complete with undefined is not an object, as we only check if (!this.store[queryId]) return; but instead we should check if (!this.store || !this.store[queryId]) return;

@apollo-cla
Copy link

@i6mi6: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@i6mi6 i6mi6 changed the title Additional check for this.store to prevent this.store[o].networkStatus=t.NetworkStatus.ready Additional check for this.store to prevent undefined error at this.store[o].networkStatus=t.NetworkStatus.ready Sep 13, 2018
Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making things more defensive sounds good to me. Thanks @i6mi6!

@hwillson hwillson merged commit 1f6708e into apollographql:master Sep 19, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 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

Successfully merging this pull request may close these issues.

None yet

3 participants