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

(fix) - portals #1749

Merged
merged 15 commits into from Jul 10, 2019
Merged

(fix) - portals #1749

merged 15 commits into from Jul 10, 2019

Conversation

JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Jul 1, 2019

Adds 101 81 123 114 103 88B to the compat package 👎

  • support switching container
  • avoid irrelevant children from rerendering
  • support placeholder vnodes
  • support multiple portals in one root
  • support nested portals

This is a remake of: #1713
I needed to clear my head a bit and start over I felt like I was stuck in a rut.

I have almost gotten to the fix the only remaining issue is that when we insert another portal in the same container and unmount one of them we lose both. I don't know if this is an issue or not.... Let's assume it is, working on a fix for it but it can possibly get quite complicated.

One of the options would be to check the _children of the array for an existing portal and if there is one remove from the array.... I’m not sure about this

@coveralls
Copy link

coveralls commented Jul 1, 2019

Coverage Status

Coverage increased (+0.1%) to 99.686% when pulling 48feffd on portalsFix into 782f454 on master.

@@ -178,8 +178,145 @@ describe('Portal', () => {
}

render(<App />, root);
expect(dialog.childNodes.length).to.equal(1);
expect(dialog.childNodes.length).to.equal(2);
Copy link
Member Author

Choose a reason for hiding this comment

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

This is because of the empty textNode, one would expect replaceNode to delete it but for some reason it isn't deleted.

@JoviDeCroock JoviDeCroock marked this pull request as ready for review July 3, 2019 08:21
@marvinhagemeister marvinhagemeister mentioned this pull request Jul 7, 2019
8 tasks
Copy link
Member

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

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

Sweet 👍 💯 As said in Slack we can revisit the root handling after the X release. For now this is the best solution we could've wished for and compat doesn't have to be as strict about size. Users that won't use Portals won't be affected anyway, because of tree shaking 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants