SIGN IN SIGN UP
facebook / react-native UNCLAIMED

A framework for building native applications using React

Fix missing reference updates with syncOnCommit (#54263)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/54263

When enabling `passChildrenWhenCloningPersistedNodes` and `updateRuntimeShadowNodeReferencesOnCommit`, updates inserting shadow nodes between existing child shadow nodes would result in shadow node reference updates being skipped.

Since `passChildrenWhenCloningPersistedNodes` requires that the react fiber references the mounted shadow node instance at all times, this would result in invalid react renders, bringing back old revisions holding invalid layout metrics.

This diff updates the reference update applied on commit, submitting the updated shadow node references for added shadow nodes. Inserted shadow nodes between existing child shadow nodes will move the previously mounted shadow nodes to the end of the child array. This leads to the `updateMountedFlag` pass to consider these as "added" shadow nodes.

Changelog: [Internal]

Reviewed By: sbuggay

Differential Revision: D85406405

fbshipit-source-id: 7bd9a492fc67549970183c0932cfd7c8b7e61312
N
Nick Lefever committed
91d5e99158e2bfd834d863454de32df7de523ad1
Parent: 3d08683
Committed by meta-codesync[bot] <215208954+meta-codesync[bot]@users.noreply.github.com> on 10/24/2025, 5:20:43 PM