Skip to content

Use consistent revisions for ResizeObserver measurements - #60159

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
rubennorte:export-D133269095
Nov 19, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
rubennorte:export-D133269095

Conversation

@rubennorte

Copy link
Copy Markdown
Member

Summary:

Context

With commit branching enabled, a React commit updates the pending React revision before it is promoted to the main shadow-tree revision. Reading the main revision directly can make ResizeObserver report newly mounted targets as detached with zero sizes, or report stale sizes during callback-driven updates.

Changes

  • Use the existing ShadowTreeRevisionProvider exposed by UIManager’s consistency manager, rather than choosing the main or React revision directly.
  • Obtain resize-observation snapshots through the same revision-selection and caching policy used by JavaScript layout reads.
  • Add public-behavior tests for subscriptions from ref callbacks and layout effects, comparing delivered sizes with layout reads during the callback.
  • Run the existing ResizeObserver suite with commit branching both enabled and disabled, including its callback-driven resize feedback case.

Changelog:
[General][Fixed] - Report consistent committed sizes from ResizeObserver when commit branching is enabled

Differential Revision: D133269095

Summary:
## Context
With commit branching enabled, a React commit updates the pending React revision before it is promoted to the main shadow-tree revision. Reading the main revision directly can make `ResizeObserver` report newly mounted targets as detached with zero sizes, or report stale sizes during callback-driven updates.

## Changes
- Use the existing `ShadowTreeRevisionProvider` exposed by UIManager’s consistency manager, rather than choosing the main or React revision directly.
- Obtain resize-observation snapshots through the same revision-selection and caching policy used by JavaScript layout reads.
- Add public-behavior tests for subscriptions from ref callbacks and layout effects, comparing delivered sizes with layout reads during the callback.
- Run the existing ResizeObserver suite with commit branching both enabled and disabled, including its callback-driven resize feedback case.

Changelog:
[General][Fixed] - Report consistent committed sizes from `ResizeObserver` when commit branching is enabled

Differential Revision: D133269095
@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 Nov 19, 2026
@meta-codesync

meta-codesync Bot commented Nov 19, 2026

Copy link
Copy Markdown

@rubennorte has exported this pull request. If you are a Meta employee, you can view the originating Diff in D133269095.

@christophpurrer christophpurrer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

@meta-codesync
meta-codesync Bot merged commit 40c4620 into react:main Nov 19, 2026
97 of 98 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @rubennorte in 40c4620

When will my fix make it into a release? | How to file a pick request?

@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 19, 2026
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 Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants