Repository navigation
Conversation
… match Summary: When a host node is cloned with its children passed in (`passChildrenWhenCloningPersistedNodes`), `YogaLayoutableShadowNode::updateYogaChildren` keeps the clone's layout clean if every new child is clean and styled like the child it replaces. That misses children that are clean and styled the same but carry a different computed layout. Yoga then reuses the parent's cached layout, never visits those children, and they keep their stale layout. Runtime shadow node reference updates produce exactly such children when `<Activity>` hides a subtree: 1. The renderer commits a `display: none` clone H of the hidden subtree's host root V. H gets its own runtime reference; the renderer keeps V, which still holds the layout and layout cache from when it was visible. 2. Laying out H zeroes out clones of V's children. Those clones inherit the children's runtime references, so the renderer now holds the zeroed revisions of V's children while it still holds the non-zeroed V. 3. Any re-render inside the subtree clones those zeroed children and then V with the new children. Every check passes, so V's clone keeps V's cached layout. 4. When the subtree is revealed, Yoga reuses that cache and the content stays at 0x0. With the children appended one by one instead, the append always dirties the parent, so this only shows up with the flag on. Also require each new child's computed size and position to match the child it replaces before keeping the clone clean. A parent's cached layout is only valid for the layouts its children had when it was computed, so this is the condition the optimization relied on. Unchanged children still match, so re-renders that do not change layout keep the layout clean. Changelog: [General][Fixed] - Fix content laid out at zero size after revealing an `<Activity>` subtree when children are passed into clones Differential Revision: D131502045
|
@lenaic has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131502045. |
This branch has not been deployed
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 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.
Summary:
When a host node is cloned with its children passed in (
passChildrenWhenCloningPersistedNodes),YogaLayoutableShadowNode::updateYogaChildrenkeeps the clone's layout clean if every new child is clean and styled like the child it replaces. That misses children that are clean and styled the same but carry a different computed layout. Yoga then reuses the parent's cached layout, never visits those children, and they keep their stale layout.Runtime shadow node reference updates produce exactly such children when
<Activity>hides a subtree:display: noneclone H of the hidden subtree's host root V. H gets its own runtime reference; the renderer keeps V, which still holds the layout and layout cache from when it was visible.With the children appended one by one instead, the append always dirties the parent, so this only shows up with the flag on.
Also require each new child's computed size and position to match the child it replaces before keeping the clone clean. A parent's cached layout is only valid for the layouts its children had when it was computed, so this is the condition the optimization relied on. Unchanged children still match, so re-renders that do not change layout keep the layout clean.
Changelog: [General][Fixed] - Fix content laid out at zero size after revealing an
<Activity>subtree when children are passed into clonesDifferential Revision: D131502045