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

Do not forceUpdate if consuming component is not mounted #7745

Merged
merged 2 commits into from
Jun 23, 2021

Conversation

wuarmin
Copy link
Contributor

@wuarmin wuarmin commented Feb 22, 2021

This change would fix the occurrence of the warning "Can't perform a React state update on an unmounted component" using useQuery in React.StrictMode.

#6209

best regards

@jgonera
Copy link

jgonera commented Jun 11, 2021

@wuarmin @brainkim Is anyone still working on this patch?

@wuarmin
Copy link
Contributor Author

wuarmin commented Jun 11, 2021

There are two failing tests. I have to invest some time, to find out, how they should be changed, or to check if their failing is correct. Can you help? Check out test details.

@wuarmin
Copy link
Contributor Author

wuarmin commented Jun 12, 2021

It would be great if someone with deeper knowledge of the project could check this 🙏

@brainkim brainkim self-requested a review June 12, 2021 17:34
@brainkim
Copy link
Contributor

I’m taking a look. The test suite is finicky. Thanks for the help!

@wuarmin
Copy link
Contributor Author

wuarmin commented Jun 23, 2021

I’m taking a look. The test suite is finicky. Thanks for the help!

@brainkim
Great, Thanks!

This fixes the warning "Can't perform a React state update on an unmounted component".
@brainkim brainkim changed the base branch from main to release-3.4 June 23, 2021 17:27
Copy link
Contributor

@brainkim brainkim left a comment

Choose a reason for hiding this comment

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

Rebasing against release-3.4 seems to have fixed the breaking tests. I was doing work related to React.StrictMode which may have made the tests more robust maybe 🙈. It’s unfortunate that this might mean we might not get to backport it to 3.3 but 3.4 is looking to be a pretty nice release with a lot of fixes and stuff. Thanks for looking into this @wuarmin.

@wuarmin
Copy link
Contributor Author

wuarmin commented Jun 23, 2021

@brainkim thank you. I'm looking forward to 3.4.

@wuarmin wuarmin changed the title Do not forceUpdate if comsuming component is not mounted Do not forceUpdate if consuming component is not mounted Jun 23, 2021
@brainkim brainkim merged commit a164bd8 into apollographql:release-3.4 Jun 23, 2021
@dylanwulf
Copy link
Contributor

dylanwulf commented Jun 23, 2021

Thank you! I was experiencing this warning when a query unmounted at the same time as refetchQueries began. I'm not running in strict mode, but this change helped! 🎉

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 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.

4 participants