Portals: logical parent vs rendering parent (M1-T14, closes #22) - #102
Merged
Conversation
- <Portal target=className> special tag; ReactNode::Portal IR + RenderedNode::Portal; children render under the first host element with that className — a different rendering parent - Reconciliation identity stays logical: per-pass resolve_portal_targets pre-scan + preassign_ids (path-order ids) so the target id is known regardless of traversal order; the OLD portal is located by path and its children matched by key — the naive old=None duplicated content on every update (caught by the state test: two <p>11</p>) - Renderer: sparse patch indices (portal children attach to a parent whose child count is unknown) clamp-append instead of panic - Missing target: children fall back to the logical position (no crash) 4 tests in tests/portals.rs; suite 145 green; clippy/fmt/audit clean. Records: M1 14/18 in progress, 50/106. Closes#22
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or 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
Sign up for freeto 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.
What
Closes#22. React portals in the subset form:
The portaled
<b>renders insidemodal-shell(rendering parent) while identity, keys, and event dispatch stay logical.ReactNode::Portal/RenderedNode::Portal: special-tag lowering; children rendered under the first Host withclassName == target.resolve_portal_targetspre-scan +preassign_ids(path-order ids, preserved for old paths) lets the portal arm resolve its target's id regardless of traversal order; the old portal is located by path and its children matched by key — without this, every re-render created fresh portal nodes and left the old ones (the state-update test caught two<p>11</p>).Verification
4 tests in
tests/portals.rs: attach under the target, logical order of siblings, state updates propagate to portaled content (minimal SetText, no duplication), missing target safe. Suite 145 green; clippy-D warningsclean; fmt clean; audit green. Records: M1 14/18, overall 50/106.