Skip to content

Conversation

@ghost
Copy link

@ghost ghost commented May 7, 2025

We merged RN 0.78 into the upgrade/new-arch branch.

We need to enable react shadow node runtime updates (RSNRU) to avoid inconsistencies between the JS react fiber tree and the shadow tree on the UI thread.

Nick Lefever and others added 5 commits May 7, 2025 13:11
…#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
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 ghost merged commit 80fa311 into 0.78.0-discord May 7, 2025
26 of 47 checks passed
bdbaraban pushed a commit 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>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant