Don't update mounted flag on React revision (#56371)

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

Changelog: [GENERAL][FIXED] - Prevent updates to mounted flag on the React revision

Currently, with fabric branching enabled, the logic for `updateMountedFlag` can run twice for the same tree: first when committing it to a react revision, then when merging to the main revision. This has the potential to drive `enableCounter_ ` negative.

This diff, makes it so that `updateMountedFlag` runs only when committing to the main branch.

Reviewed By: rubennorte, cipolleschi

Differential Revision: D99996551

fbshipit-source-id: 8e578b3bf1e22ef1f87fdd0df20dc25bb4631ccf
This commit is contained in:
Jakub Piasecki authored and meta-codesync[bot] committed 2026-04-08 09:23:58 -07:00
1 parent 4a59f90c22
commit 7ee893d3be
1 file changed
+1 -1
@@ -422,7 +422,7 @@ CommitStatus ShadowTree::tryCommit(
auto newRevisionNumber = currentRevision_.number + 1;
{
if (!isReactBranch) {
std::scoped_lock dispatchLock(EventEmitter::DispatchMutex());
updateMountedFlag(
currentRevision_.rootShadowNode->getChildren(),