Respect Android Fabric event coalescing keys#57074
Open
sorinc03 wants to merge 2 commits into
Open
Conversation
javache
reviewed
Jun 10, 2026
javache
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR!
I think it would be good to split this in two changes: one that adds support to react/renderer/core and one that adopts in the Android integration.
Comment on lines
85
to
+87
| fun dispatchUnique(eventName: String, params: WritableMap?, eventTimestamp: Long) { | ||
| dispatchUnique(eventName, params, eventTimestamp, 0) | ||
| } |
Contributor
There was a problem hiding this comment.
This class is internal - we don't need to do overloads or keep the API compatible, let's just make sure we update all the callers.
| // queue. | ||
| if (it->isUnique && it->type == rawEvent.type) { | ||
| if (it->isUnique && it->type == rawEvent.type && | ||
| it->coalescingKey == rawEvent.coalescingKey) { |
Contributor
There was a problem hiding this comment.
Should this account for RawEvent::DefaultCoalescingKey?
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:
Fixes #54635.
Android Fabric receives a
customCoalesceKeyfromEvent.dispatchModern, but the key was dropped before the event reached the C++ Fabric queue. This meant coalescable custom native events with the same target/name but different keys could incorrectly replace each other before JS received them.This change threads the custom coalescing key through the Android Fabric event path and stores it on
RawEvent. The C++ event queue now only coalesces unique events when target, event type, and coalescing key all match. Existing callers continue to use the default key0, so the previous default coalescing behavior is preserved.Changelog:
[ANDROID] [FIXED] - Respect custom coalescing keys for Fabric events on Android
Test Plan:
./gradlew :packages:react-native:ReactAndroid:testDebugUnitTest --tests com.facebook.react.fabric.SurfaceMountingManagerEventOrderingTest --tests com.facebook.react.fabric.events.FabricEventEmitterTest -Preact.internal.useHermesNightly=false ./gradlew :packages:react-native:ReactAndroid:ktfmtCheck -Preact.internal.useHermesNightly=false ./gradlew ':packages:react-native:ReactAndroid:buildCMakeDebug[arm64-v8a][hermestooling,jsi,etc]' -Preact.internal.useHermesNightly=false git diff --check