feat(Reactions): send emoji_code with reactions for push notification rendering#3209
Conversation
β¦ rendering Resolve the native emoji for a reaction type from the configured reaction options and include it as `emoji_code` in the `sendReaction` payload so mobile push notification templates can render the emoji. Defaults and any custom reaction options defining `unicode` are supported automatically; legacy array options and options without `unicode` send no `emoji_code`. No public API change. REACT-880
|
Size Change: +659 B (+0.1%) Total Size: 656 kB π¦ View Changed
βΉοΈ View Unchanged
|
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (5)
π WalkthroughWalkthroughThis PR adds emoji code support to message reactions by introducing emoji lookup helpers, integrating them into the reaction handler hook, and verifying the payload changes end-to-end. The flow reads reaction options from context, derives emoji codes for each reaction type, and includes them when sending reactions. ChangesEmoji Code Support in Reactions
Sequence DiagramsequenceDiagram
participant Sender as Reaction Sender
participant Handler as useReactionHandler
participant Context as ComponentContext
participant Emoji as getEmojiCodeByReactionType
participant API as sendReaction
Sender->>Handler: toggleReaction(reactionType)
Handler->>Context: read reactionOptions
Handler->>Emoji: resolve emoji code by type
Emoji-->>Handler: emoji_code: string | undefined
Handler->>API: sendReaction({ type, emoji_code })
API-->>Sender: reaction sent
Estimated code review effortπ― 3 (Moderate) | β±οΈ ~20 minutes Poem
π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 warning)
β Passed checks (4 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3209 +/- ##
==========================================
+ Coverage 83.84% 83.92% +0.08%
==========================================
Files 439 439
Lines 13212 13222 +10
Branches 4286 4293 +7
==========================================
+ Hits 11077 11097 +20
+ Misses 2135 2125 -10 β View full report in Codecov by Harness. π New features to boost your workflow:
|
## [14.4.0](v14.3.0...v14.4.0) (2026-06-05) ### Bug Fixes * **compat:** restore React 17/18 compatibility in certain components ([#3197](#3197)) ([b513b69](b513b69)) * general performance and bug fixes ([#3201](#3201)) ([57c5795](57c5795)) * **interop:** unwrap CJS default exports (react-player, @emoji-mart/react) ([#3199](#3199)) ([4cddb02](4cddb02)) * maintain topmost modal non-inert ([#3206](#3206)) ([7ad98fa](7ad98fa)) ### Features * allow to stack modals on top of each other ([#3203](#3203)) ([4c934ae](4c934ae)) * display notifications above modals ([#3200](#3200)) ([0433090](0433090)) * **Reactions:** send emoji_code with reactions for push notification rendering ([#3209](#3209)) ([2faa620](2faa620)) ### Performance Improvements * **Message:** hoist regex compilation in message text rendering ([#3202](#3202)) ([8c018a4](8c018a4)) * **VideoPlayer:** lazy-load react-player to keep it out of the main bundle ([#3204](#3204)) ([18dc966](18dc966))
|
π This PR is included in version 14.4.0 π The release is available on: Your semantic-release bot π¦π |
π― Goal
Reactions sent via
channel.sendReactiondid not includeemoji_code, so mobile push notification templates (e.g. forreaction.new) had no emoji to render. This wires the React SDK to includeemoji_codein the reaction request payload so mobile SDKs can render the correct emoji in push notifications.Linear: REACT-880
π Implementation details
getEmojiCodeByReactionType(reactionOptions, type)inreactionOptions.tsxresolves the native emoji character (e.g.π) for a reaction type from the option's existingunicodefield viaunicodeToEmoji(). Returnsundefinedfor legacy array options or options that omitunicode, so we never send a garbage code.useReactionHandlernow readsreactionOptionsfromComponentContext(falling back todefaultReactionOptions, like other consumers) and includesemoji_codein thesendReactionpayload when one resolves:handleReaction(type, event)signature is unchanged.mapEmojiMartDatanow storesunicodeon each mapped entry, so emoji picked from the extended (emoji-mart) list also resolve anemoji_code.stream-chatReactiontype already supports the optionalemoji_codefield β only stream-chat-react needed to populate it.Behavior: default reactions (
like,love,haha,sad,wow,fire) and any custom reactions definingunicodenow shipemoji_codeautomatically. Legacy array-form reaction options carry no unicode data and continue to send noemoji_code(graceful, unchanged otherwise).Tests: new
reactionOptions.test.tscovering the helper (quick/extended/legacy-array/unknown/missing-unicode) andmapEmojiMartData;useReactionHandlertests for default/custom/no-unicode payloads and the optimistic preview; updated the existingMessage.test.tsxsend assertion to the new contract.π¨ UI Changes
None β this only affects the network payload sent with reactions (and the local optimistic reaction object). No visual changes.
Summary by CodeRabbit
Release Notes
New Features
Tests