Repository navigation
Conversation
…rted in one transaction Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tomekzaw
marked this pull request as ready for review
October 31, 2026 08:22
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
A view that isn't preallocated gets a Create and an Insert in the same mount transaction, for example a layout-only
Viewthat gains abackgroundColorand stops being flattened. The Create item already passes the view's state and event emitter to Java:SurfaceMountingManager.createViewUnsafestores both in theViewState, andViewManager.createViewapplies the state. The Insert then always addsUpdateStateandUpdateEventEmitteritems for the same objects. So C++ builds a secondStateWrapperImplandEventEmitterWrapper, and Java callsViewManager.updateStateagain and destroys the first wrappers.executeMountnow remembers the state and event emitter of each view created in the transaction. Insert skips itsUpdateStateandUpdateEventEmitteritems when they would pass the same objects. Preallocated views, which get no Create item, and views whose state changed between Create and Insert still get them.Changelog:
[ANDROID] [CHANGED] - Stop sending the state and event emitter twice for views created and inserted in the same mount transaction
Test Plan:
A Playground screen with 300 layout-only views that gain a
backgroundColorevery 500 ms, so each such transaction creates and inserts 300 views. Time per transaction:executeMount(C++)These views have no state, so the C++ side builds 300 fewer
EventEmitterWrappers per transaction. The Java side is dominated by creating the 300 Android views, so the skippedupdateEventEmittercalls don't show there. On the Pixel 9a the C++ interval is wide, −23% to −4%.Setup:
./gradlew :packages:rn-tester:android:app:assembleRelease -PreactNativeArchitectures=arm64-v8a, R8 on) with default feature flags, compiled withcmd package compile -m speed.mainand this PR (16 processes per build).Also checked on the Galaxy A16: a box that gains a background and an
onTouchEndhandler (so it gets a Create item) renders and counts taps.🤖 Generated with Claude Code