-
Notifications
You must be signed in to change notification settings - Fork 25k
Move shadow node reference updates to tree commit #50753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
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
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D73038439 |
Differential Revision: D73038438
lenaic
pushed a commit
to lenaic/react-native-macos
that referenced
this pull request
Apr 23, 2025
Summary: Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node. This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes. This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout. By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times. This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038439
226cecc to
6417af5
Compare
Summary: Pull Request resolved: facebook#50753 Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node. This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes. This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout. By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times. This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038439
Contributor
|
This pull request was exported from Phabricator. Differential Revision: D73038439 |
6417af5 to
6eef23b
Compare
Contributor
|
This pull request has been merged in 1156c08. |
ghost
pushed a commit
to discord/react-native
that referenced
this pull request
May 7, 2025
Summary: Pull Request resolved: facebook#50753 Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node. This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes. This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout. By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times. This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038439 fbshipit-source-id: d90308498f3c0625dc87158f15311d1088aad8b0
ghost
pushed a commit
to discord/react-native
that referenced
this pull request
May 7, 2025
* Split shadow node reference setter and update functionality (facebook#50752) Summary: Pull Request resolved: facebook#50752 Storing the runtime reference for a shadow node and updating the runtime reference to point at a specific shadow node should be separated so that these actions can be done at different moments in time. We want to keep a reference to the runtime reference of a shadow node for all revisions cloned internally (not triggered by the React renderer, e.g. on layout or shadow node state updates). We also want to support updating that runtime reference to point at a specific shadow node revision, ideally the one that will end up being used to mount the host component. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038438 fbshipit-source-id: 68c3912cbb077d790dd8d2abe8291548b12c8231 * Move shadow node reference updates to tree commit (facebook#50753) Summary: Pull Request resolved: facebook#50753 Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node. This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes. This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout. By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times. This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038439 fbshipit-source-id: d90308498f3c0625dc87158f15311d1088aad8b0 * rename feature flag used mirroring: facebook@1156c08#diff-401e4af73546645a81c7e2c576b1319d0d819d92d0c214c88e3759bcb4d5e9c2R53-R54 * enable feature flag * rename feature flag used mirroring: facebook@1156c08#diff-401e4af73546645a81c7e2c576b1319d0d819d92d0c214c88e3759bcb4d5e9c2R53-R54 --------- Co-authored-by: Nick Lefever <lefever@meta.com> Co-authored-by: Hanno J. Gödecke <die.drei99@yahoo.de>
bdbaraban
pushed a commit
to discord/react-native
that referenced
this pull request
May 22, 2025
* Split shadow node reference setter and update functionality (facebook#50752) Summary: Pull Request resolved: facebook#50752 Storing the runtime reference for a shadow node and updating the runtime reference to point at a specific shadow node should be separated so that these actions can be done at different moments in time. We want to keep a reference to the runtime reference of a shadow node for all revisions cloned internally (not triggered by the React renderer, e.g. on layout or shadow node state updates). We also want to support updating that runtime reference to point at a specific shadow node revision, ideally the one that will end up being used to mount the host component. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038438 fbshipit-source-id: 68c3912cbb077d790dd8d2abe8291548b12c8231 * Move shadow node reference updates to tree commit (facebook#50753) Summary: Pull Request resolved: facebook#50753 Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node. This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes. This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout. By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times. This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038439 fbshipit-source-id: d90308498f3c0625dc87158f15311d1088aad8b0 * rename feature flag used mirroring: facebook@1156c08#diff-401e4af73546645a81c7e2c576b1319d0d819d92d0c214c88e3759bcb4d5e9c2R53-R54 * enable feature flag * rename feature flag used mirroring: facebook@1156c08#diff-401e4af73546645a81c7e2c576b1319d0d819d92d0c214c88e3759bcb4d5e9c2R53-R54 --------- Co-authored-by: Nick Lefever <lefever@meta.com> Co-authored-by: Hanno J. Gödecke <die.drei99@yahoo.de>
Flewp
pushed a commit
to discord/react-native
that referenced
this pull request
Jul 7, 2025
Summary: Pull Request resolved: facebook#50753 Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node. This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes. This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout. By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times. This change is gated behind the `updateRuntimeShadowNodeReferencesOnCommit` feature flag, which enabled shadow node syncing from any thread and reference updates only during the commit. Changelog: [Internal] Reviewed By: rubennorte Differential Revision: D73038439 fbshipit-source-id: d90308498f3c0625dc87158f15311d1088aad8b0
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
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:
Runtime Shadow Node Reference Updates (RSNRU) is currently implemented through the clone method which on each internal clone updates the runtime reference to point to the new clone. This guarantees that the runtime reference always points at the latest revision of the shadow node.
This came with the constraint that RSNRU could only run from one thread at all times, otherwise the React renderer state (current fiber tree) would end up being corrupted by receiving reference updates from multiple threads cloning shadow nodes.
This change moves the reference update step to the locked scope of the commit phase. Since the runtime is blocking on the commit and the scope is locked, it is safe and correct to update the runtime references with the latest revision of the shadow node after running state progression and layout.
By moving the reference update to the commit, we can support shadow node syncing from any thread since the actual runtime references are now executing at a safe time and the renderer state will stay valid at all times.
This change is gated behind the
updateRuntimeShadowNodeReferencesOnCommitfeature flag, which enabled shadow node syncing from any thread and reference updates only during the commit.Changelog: [Internal]
Differential Revision: D73038439