-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 2.0 #1713
Closed
Closed
(fix) - portals 2.0 #1713
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JoviDeCroock
commented
Jun 13, 2019
JoviDeCroock
commented
Jun 13, 2019
JoviDeCroock
commented
Jun 13, 2019
Closing this due to remake |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current problems
Initial render
I moved this to a solution where we prepend children to the root's _children array and after that call
forceUpdate
since roots are components. This in theory could be a good approach but when we initially render, forceUpdate won't do anything, since _vnode etc isn't defined yet. (I have tried setting an empty state didn't work either).Inserting multiple roots
Our former solution where we used
hydrate('', container)
makes it so that the second insertion hydrates the first portal. This in turn makes it so that we can't unmount the first one withrender(null, container)
anymore. This was a signifier that we should avoid using hydrate for portals.Switching container
At the moment I rely on
render(null, container)
to work, in theory this should be good enough for the time being but when we have a better solution we should test more thorough.Singular insertions
Note that the singular insertions at the moment are working since these fallback to
hydrate
andrender
, these tests are always on initial render etc so don't take these passes for granted.How did we get here?
First we encountered the issue that we didn't insert portals, we made the assumption that portals were rendering into empty roots.
We solved this by prepending the portalChild, this in turn unmounted all children when using
render(null, container)
. This was solved by usinghydrate('', container)
.I could really use a few pointers on this since I feel like I've been going in the same circle for a while now.
Test cases added for the new issue report, thanks to @MichaelRando for the reproductions
Found a missing case to allow changing container, these two failing tests leave me jumbled though.
Been researching the hint provided about Fragments but this feels like odd behavior