Skip to content

Update runtime shadow node references when cloning within react native#44770

Closed
lenaic wants to merge 3 commits into
facebook:mainfrom
lenaic:export-D57860867
Closed

Update runtime shadow node references when cloning within react native#44770
lenaic wants to merge 3 commits into
facebook:mainfrom
lenaic:export-D57860867

Conversation

@lenaic
Copy link
Copy Markdown

@lenaic lenaic commented Jun 3, 2024

Summary:
Changelog: [Internal]

Any shadow node cloning happening outside the execution of the UIManagerBinding cloneNode function should update references held to the shadow node to reference the latest revision. All shadow node cloning not requested by the JS runtime should update the references to those shadow nodes within the JS runtime so that these would hold the latest state updated outside of the React renderer (i.e. state data and layout metrics).

This guarantees that the React renderer's current fiber tree holds references to the ShadowNode instances that acually were layed out and committed for rendering on the native side. Maintaining these references up to date on the JS current fiber tree allows to maximize layout cache usage on subsequent commits.

Reviewed By: sammy-SC

Differential Revision: D57860867

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 3, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented Jun 3, 2024

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 19,593,075 +16,472
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 22,962,576 +16,425
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: a6a7cdf
Branch: main

Nick Lefever added 3 commits June 3, 2024 17:41
…k#44769)

Summary:

Changelog: [Internal]

Adding a feature flag to conditionally enable shadow node reference updates when cloning nodes within react native.

Reviewed By: sammy-SC

Differential Revision: D57860868
…acebook#44772)

Summary:

Changelog: [Internal]

React native clones shadow nodes internally without providing the new instances to the React renderer (current fiber tree). To support updating the shadow node references held by the JS side, this diff wraps the returned shadow nodes and adds a link to the runtime reference on the shadow node instance.

This will allow for updating the shadow node references held within the JS runtime from the native side.

Reviewed By: sammy-SC

Differential Revision: D57860869
facebook#44770)

Summary:

Changelog: [Internal]

Any shadow node cloning happening outside the execution of the UIManagerBinding `cloneNode` function should update references held to the shadow node to reference the latest revision. All shadow node cloning not requested by the JS runtime should update the references to those shadow nodes within the JS runtime so that these would hold the latest state updated outside of the React renderer (i.e. state data and layout metrics).

This guarantees that the React renderer's current fiber tree holds references to the ShadowNode instances that acually were layed out and committed for rendering on the native side. Maintaining these references up to date on the JS current fiber tree allows to maximize layout cache usage on subsequent commits.

Reviewed By: sammy-SC

Differential Revision: D57860867
@lenaic lenaic force-pushed the export-D57860867 branch from 9656264 to 3df1028 Compare June 4, 2024 00:42
@facebook-github-bot
Copy link
Copy Markdown
Contributor

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

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 4, 2024
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request has been merged in a643e19.

kosmydel pushed a commit to kosmydel/react-native that referenced this pull request Jun 11, 2024
facebook#44770)

Summary:
Pull Request resolved: facebook#44770

Changelog: [Internal]

Any shadow node cloning happening outside the execution of the UIManagerBinding `cloneNode` function should update references held to the shadow node to reference the latest revision. All shadow node cloning not requested by the JS runtime should update the references to those shadow nodes within the JS runtime so that these would hold the latest state updated outside of the React renderer (i.e. state data and layout metrics).

This guarantees that the React renderer's current fiber tree holds references to the ShadowNode instances that acually were layed out and committed for rendering on the native side. Maintaining these references up to date on the JS current fiber tree allows to maximize layout cache usage on subsequent commits.

Reviewed By: sammy-SC

Differential Revision: D57860867

fbshipit-source-id: f13e3fa9ad501fb2c8a387fb58b6379d236d7c2d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants