Skip to content

Merge synchronous props queued for an unmounted view with newer updates - #60487

Merged
meta-codesync[bot] merged 1 commit into
react:mainfrom
bumjung:export-D132802978
Dec 2, 2026
Merged

meta-codesync[bot] merged 1 commit into
react:mainfrom
bumjung:export-D132802978

Conversation

@bumjung

@bumjung bumjung commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Summary:
When a synchronous (native-driven animated) props update arrives for a view that doesn't exist yet, FabricUIManager queues it behind the pending mount items. The view can mount and get a newer synchronous update applied directly before the queued one runs, for example when a view command focuses the new view and fires an event that drives native animated props. The queued update then puts the older props back on the view and stores them as its synchronous mount props override, which also beats the next Fabric commit, so the view keeps the stale values: text that should change color on focus stays in its unfocused color.

Synchronous props for a view that doesn't exist yet now merge into one pending map per view (PendingSynchronousProps): a newer value wins, and a newer null still resets the prop. Each pending update queues a mount item behind the pending mount items, and only the newest one applies the merged props, so they also wait for mount items queued in between, such as the one that creates the view. An update applied directly while props are pending applies them merged with its own and clears them. synchronouslyUpdateViewOnUIThread and the batched path (synchronouslyUpdateViewBatch) both go through it; the batched path still looks each view up once unless props are pending for it.

Changelog:
[Android][Fixed] - Fix a stale queued animated props update overwriting a newer one when a view mounts and updates in the same frame

Reviewed By: zeyap

Differential Revision: D132802978

Summary:
When a synchronous (native-driven animated) props update arrives for a view that doesn't exist yet, `FabricUIManager` queues it behind the pending mount items. The view can mount and get a newer synchronous update applied directly before the queued one runs, for example when a view command focuses the new view and fires an event that drives native animated props. The queued update then puts the older props back on the view and stores them as its synchronous mount props override, which also beats the next Fabric commit, so the view keeps the stale values: text that should change color on focus stays in its unfocused color.

Synchronous props for a view that doesn't exist yet now merge into one pending map per view (`PendingSynchronousProps`): a newer value wins, and a newer `null` still resets the prop. Each pending update queues a mount item behind the pending mount items, and only the newest one applies the merged props, so they also wait for mount items queued in between, such as the one that creates the view. An update applied directly while props are pending applies them merged with its own and clears them. `synchronouslyUpdateViewOnUIThread` and the batched path (`synchronouslyUpdateViewBatch`) both go through it; the batched path still looks each view up once unless props are pending for it.

Changelog:
[Android][Fixed] - Fix a stale queued animated props update overwriting a newer one when a view mounts and updates in the same frame

Reviewed By: zeyap

Differential Revision: D132802978
@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 Dec 2, 2026
@facebook-github-tools facebook-github-tools Bot added p: Facebook Partner: Facebook Partner labels Dec 2, 2026
@meta-codesync

meta-codesync Bot commented Dec 2, 2026

Copy link
Copy Markdown

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

@zeyap zeyap 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.

@zeyap

zeyap commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

cc @bartlomiejbloniarz

@meta-codesync
meta-codesync Bot merged commit afe2bf8 into react:main Dec 2, 2026
64 of 69 checks passed
@react-native-bot

Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @bumjung in afe2bf8

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 Dec 2, 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