Repository navigation
fix(Attachment): render giphy attachments in their own group with uni… - #3325
Conversation
…que keys Giphy attachments were pushed into the `card` group while keyed with the length of the always-empty `giphy` group, so every giphy got the key `giphy-0`. A message with more than one giphy triggered the React duplicate-key warning and could reconcile the wrong element. Push them into the `giphy` group that ATTACHMENT_GROUPS_ORDER already reserves, so keys are unique and giphys render in their intended position, before link-preview cards.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Size Change: -1.28 kB (-0.11%) Total Size: 1.13 MB 📦 View Changed
ℹ️ View Unchanged
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-v14 #3325 +/- ##
===============================================
+ Coverage 85.63% 85.89% +0.26%
===============================================
Files 521 524 +3
Lines 16555 16649 +94
Branches 5208 5229 +21
===============================================
+ Hits 14177 14301 +124
+ Misses 2378 2348 -30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🎯 Goal
Inside a thread,
MessageListreads its unread state from the thread's message paginator (useMessagePaginator()): the unread banner, the "N new" notification anduseMarkReadall use the thread'sunreadStateSnapshot.useMessageListElementswas the exception. It always subscribed tochannel.messagePaginator.unreadStateSnapshot, even when the list rendered a thread.As a result:
renderMessageson every change to the channel's unread snapshot (e.g. a new channel message arriving while the channel is scrolled up), although nothing in the thread changed;renderMessagesused in a thread received the channel's unread state inchannelUnreadUiStateinstead of the thread's.No unread separator rendered incorrectly:
getIsFirstUnreadMessagealready returnsfalsefor thread replies (they carry aparent_id), so the default UI looked the same either way.🛠 Implementation details
useMessageListElementsnow subscribes touseMessagePaginator().unreadStateSnapshot, which resolves to the thread's paginator inside a thread and the channel's otherwise. This matches howMessageList,useUnreadMessagesNotificationanduseMarkReadalready resolve it. Outside a thread nothing changes.Behavior note for integrators: a custom
renderMessagesrendered inside a thread now receives the thread's unread snapshot inchannelUnreadUiState. The parameter name is unchanged.Test added in
MessageList.test.tsx, using a real thread fromclient.threads.ensure()(the existing thread stub shares the channel's paginator, so it could not tell the two apart):renderMessages;It fails without the change and passes with it. The MessageList, Thread and Threads suites pass, and
yarn lint/yarn typesare clean.🎨 UI Changes
None. The change affects which store the thread's message list subscribes to, not what it renders.