Skip to content

Fix dropped React revision when merging commit branches#57424

Closed
j-piasecki wants to merge 1 commit into
react:mainfrom
j-piasecki:export-D110577969
Closed

Fix dropped React revision when merging commit branches#57424
j-piasecki wants to merge 1 commit into
react:mainfrom
j-piasecki:export-D110577969

Conversation

@j-piasecki

Copy link
Copy Markdown
Contributor

Summary:
With commit branching (enableFabricCommitBranching), commits from React land on
a separate revision (currentReactRevision_) that is later merged into the main
tree. React-branch revisions are numbered off the main revision, so two React
commits that occur before the main revision advances get the SAME revision
number.

mergeReactRevision decided whether to clear currentReactRevision_ by comparing
revision numbers. When a newer React revision landed before the merge of the
previous one completed, its coincidentally-equal number caused it to be cleared,
silently dropping a pending update. It also cleared the revision even when the
merge commit did not succeed.

Fix:

  • Clear currentReactRevision_ by comparing root shadow node identity instead of
    the revision number, and only when the merge commit actually succeeded.
  • Compute the React-branch revision number from the snapshot taken under the
    shared lock instead of reading currentRevision_ without the (deferred) unique
    lock.

Changelog: [General][Fixed] Fixed potential revision drop during merge

Differential Revision: D110577969

Summary:
With commit branching (enableFabricCommitBranching), commits from React land on
a separate revision (currentReactRevision_) that is later merged into the main
tree. React-branch revisions are numbered off the main revision, so two React
commits that occur before the main revision advances get the SAME revision
number.

mergeReactRevision decided whether to clear currentReactRevision_ by comparing
revision *numbers*. When a newer React revision landed before the merge of the
previous one completed, its coincidentally-equal number caused it to be cleared,
silently dropping a pending update. It also cleared the revision even when the
merge commit did not succeed.

Fix:
- Clear currentReactRevision_ by comparing root shadow node identity instead of
  the revision number, and only when the merge commit actually succeeded.
- Compute the React-branch revision number from the snapshot taken under the
  shared lock instead of reading currentRevision_ without the (deferred) unique
  lock.

Changelog: [General][Fixed] Fixed potential revision drop during merge

Differential Revision: D110577969
@meta-cla meta-cla 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 Jul 3, 2026
@meta-codesync

meta-codesync Bot commented Jul 3, 2026

Copy link
Copy Markdown

@j-piasecki has exported this pull request. If you are a Meta employee, you can view the originating Diff in D110577969.

@facebook-github-tools facebook-github-tools Bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Jul 3, 2026
@meta-codesync meta-codesync Bot closed this in c65845c Jul 3, 2026
@meta-codesync meta-codesync Bot added the Merged This PR has been merged. label Jul 3, 2026
@meta-codesync

meta-codesync Bot commented Jul 3, 2026

Copy link
Copy Markdown

This pull request has been merged in c65845c.

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. Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant