Skip to content

Fix crash unmounting an empty Portal - #14820

Merged
gaearon merged 2 commits into
react:masterfrom
gaearon:portal-bug
Feb 11, 2019
Merged

gaearon merged 2 commits into
react:masterfrom
gaearon:portal-bug

Conversation

@gaearon

@gaearon gaearon commented Feb 11, 2019

Copy link
Copy Markdown
Contributor

Fixes #14811. Thanks @KhodorAmmar for the repro case.

The bug is that we won't pop the portal if it had no children. So we shouldn't push its container either.

@sophiebits sophiebits left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

More error-prone than I’d like, but I agree with your fix and don’t see a cleaner way to structure it.

@gaearon
gaearon merged commit 1fecba9 into react:master Feb 11, 2019
@gaearon
gaearon deleted the portal-bug branch February 11, 2019 18:40
This was referenced Sep 20, 2019
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
* Adds failing test for react#14811

* Fix removeChild() crash when removing an empty Portal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants