Fix display: contents nodes not being cloned with the wrong owner #1826

Closed
j-piasecki wants to merge 1 commits from @jpiasecki/contents-fix-updates into main
j-piasecki commented 2025-07-10 02:44:36 -07:00 (Migrated from github.com)

This PR fixes two issues with display: contents implementation:

  1. When a node with display: contents set is a leaf, it won't be cloned after the initial tree is built. The added test case covers this scenario.
  2. It was possible for the subtree of display: contents nodes not to be cloned during layout. I don't have a minimal reproduction for this one, unfortunately. It was discovered in the Expensify app: https://github.com/Expensify/App/issues/65268, along with a consistent reproduction. In that specific case, it seems to be heavily tied to react-native-onyx, which is a state management library.
This PR fixes two issues with `display: contents` implementation: 1. When a node with `display: contents` set is a leaf, it won't be cloned after the initial tree is built. The added test case covers this scenario. 2. It was possible for the subtree of `display: contents` nodes not to be cloned during layout. I don't have a minimal reproduction for this one, unfortunately. It was discovered in the Expensify app: https://github.com/Expensify/App/issues/65268, along with a consistent reproduction. In that specific case, it seems to be heavily tied to `react-native-onyx`, which is a state management library.
vercel[bot] commented 2025-07-10 02:44:42 -07:00 (Migrated from github.com)

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
yoga-website Ready (Inspect) Visit Preview 💬 Add feedback Jul 10, 2025 0:25am
[vc]: #aXdfITQxWzog53bsyAe1WW2vziBznd8jQdqQBwPD0Ho=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJ5b2dhLXdlYnNpdGUiLCJyb290RGlyZWN0b3J5Ijoid2Vic2l0ZSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9mYm9wZW5zb3VyY2UveW9nYS13ZWJzaXRlL0N1VXhlNjZTWGFZTDUzcUIxSEEyaVk2cGF1V2QiLCJwcmV2aWV3VXJsIjoieW9nYS13ZWJzaXRlLWdpdC1mb3JrLWotcGlhc2Vja2ktanBpYXNlY2tpLTVkODdhMS1mYm9wZW5zb3VyY2UudmVyY2VsLmFwcCIsIm5leHRDb21taXRTdGF0dXMiOiJERVBMT1lFRCIsImxpdmVGZWVkYmFjayI6eyJyZXNvbHZlZCI6MCwidW5yZXNvbHZlZCI6MCwidG90YWwiOjAsImxpbmsiOiJ5b2dhLXdlYnNpdGUtZ2l0LWZvcmstai1waWFzZWNraS1qcGlhc2Vja2ktNWQ4N2ExLWZib3BlbnNvdXJjZS52ZXJjZWwuYXBwIn19XX0= **The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more) | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **yoga-website** | ✅ Ready ([Inspect](https://vercel.com/fbopensource/yoga-website/CuUxe66SXaYL53qB1HA2iY6pauWd)) | [Visit Preview](https://yoga-website-git-fork-j-piasecki-jpiasecki-5d87a1-fbopensource.vercel.app) | 💬 [**Add feedback**](https://vercel.live/open-feedback/yoga-website-git-fork-j-piasecki-jpiasecki-5d87a1-fbopensource.vercel.app?via=pr-comment-feedback-link) | Jul 10, 2025 0:25am |
facebook-github-bot commented 2025-07-10 02:46:51 -07:00 (Migrated from github.com)

@j-piasecki has imported this pull request. If you are a Meta employee, you can view this in D78084270.

@j-piasecki has imported this pull request. If you are a Meta employee, you can view this in [D78084270](https://www.internalfb.com/diff/D78084270?dst_version_fbid=1391931968781476).
facebook-github-bot commented 2025-07-10 05:23:19 -07:00 (Migrated from github.com)

This pull request was exported from Phabricator. Differential Revision: D78084270

This pull request was **exported** from Phabricator. Differential Revision: [D78084270](https://www.internalfb.com/diff/D78084270)
facebook-github-bot commented 2025-07-11 02:23:03 -07:00 (Migrated from github.com)

@j-piasecki merged this pull request in facebook/yoga@c7c85621fc.

@j-piasecki merged this pull request in facebook/yoga@c7c85621fc5a70ef2a169a1fe359acf38476e4cd.

Pull request closed

Sign in to join this conversation.
No description provided.