Repository navigation
Conversation
…ee still uses Summary: **The Bug** Showing a subtree hidden with `<Activity mode="hidden">` again can abort debug builds with `Attempt to mutate a sealed object` (`Sealable::ensureUnsealed`, from `YogaLayoutableShadowNode::yogaNodeCloneCallbackConnector`). Release builds have no assertion, so the same layout pass silently changes shadow nodes that the committed tree still uses. **The Cause** React keeps the instance of a hidden host component, commits a `display: none` clone of it that shares its children, and appends the instance itself again when the subtree is shown. Since react/yoga#2055, zeroing out a `display: none` subtree no longer clones children that are already zeroed out, so the committed tree can share a child that the kept instance owns. The instance was never appended, so it has no owner, and appending it again adopts it in place. Its layout then treats the shared child as its own and lays it out in place. **The Fix** `YogaLayoutableShadowNode` records when a node is cloned while it has no owner. Appending such a node clones it instead of adopting it in place, so the shared children get cloned before they are laid out. The clone is marked dirty, so children that hold a layout zeroed out under the hidden clone are laid out again. react/yoga#2055's optimization stays in place. Changelog: [General][Fixed] - Fix showing a subtree hidden with `<Activity>` laying out shadow nodes in place that the committed tree still uses, which crashed debug builds Differential Revision: D131235535
|
@casos92 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D131235535. |
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:
The Bug
Showing a subtree hidden with
<Activity mode="hidden">again can abort debug builds withAttempt to mutate a sealed object(Sealable::ensureUnsealed, fromYogaLayoutableShadowNode::yogaNodeCloneCallbackConnector). Release builds have no assertion, so the same layout pass silently changes shadow nodes that the committed tree still uses.The Cause
React keeps the instance of a hidden host component, commits a
display: noneclone of it that shares its children, and appends the instance itself again when the subtree is shown. Since react/yoga#2055, zeroing out adisplay: nonesubtree no longer clones children that are already zeroed out, so the committed tree can share a child that the kept instance owns. The instance was never appended, so it has no owner, and appending it again adopts it in place. Its layout then treats the shared child as its own and lays it out in place.The Fix
YogaLayoutableShadowNoderecords when a node is cloned while it has no owner. Appending such a node clones it instead of adopting it in place, so the shared children get cloned before they are laid out. The clone is marked dirty, so children that hold a layout zeroed out under the hidden clone are laid out again. react/yoga#2055's optimization stays in place.Changelog:
[General][Fixed] - Fix showing a subtree hidden with
<Activity>laying out shadow nodes in place that the committed tree still uses, which crashed debug buildsDifferential Revision: D131235535