refactor: delivery receipts v10 - #3823
Merged
Merged
Conversation
Contributor
SDK Size
|
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.
🎯 Goal
Message status ticks are wrong on
V10: only the newest own message ever shows read/delivered, every older one falls back to a single check.MessageStatusreadreadersByMessageId[id], which answers "whose cursor stops here" (what positions a read avatar), not "who has read this" — andreadBy > 1assumed the current user was in that bucket. Both were correct in v8/v9, where the value came fromreadersForMessage; the V10 rework swapped the data source without changing the consumer.The same swap silently changed
useMessageReadData/useMessageDeliveredData— same signature, different question — so integrators now get a near-empty list with no error.🛠 Implementation details
lastReadRefByOthers/lastDeliveredRefByOthers(stream-chat2 GIFs in one single message #1883,rc.13) via newuseIsMessageReadByOthers/useIsMessageDeliveredToOthers. One comparison against the furthest cursor, so an older message can never report less than a newer one. Own-user exclusion moves into the LLC.MessageStatussubscribes itself instead of receiving counts throughMessageContext. Those counts had one consumer but sat on the context value, andReact.memocan't block a context-driven re-render — so every receipt event re-rendered eight subcomponents on every mounted row. Measured on a 20-row window:useMessageContextcalls per emit 26 → 2, receipts subscriptions 24 → 4, footer re-renders 1 → 0.useMessageReadData/useMessageDeliveredDatarestored toreadersForMessage/deliveredForMessage, in the v9 shape.stream-chatAndroid - The pictures (available for the attachment) are disappeared suddenly. #1881 (two newCORE_NOTIFICATION_TYPEmembers) and Performance lag when trying to search a message in the Channel #1882 (send/retrysplit into distinct operation kinds).API changes — all pre-release, the RN SDK has never published a v10:
readBy/deliveredToCountremoved fromMessageContextValue,MessageProps,MessageStatusPropsWithContext.MessageStatusPropsis now{ read?: boolean; delivered?: boolean }.useMessageReadCount/useMessageDeliveredToCountdeleted — zero consumers, never existed in v9, and their docs pointed at the bug above.ThreadFooterComponentusesshowMessageStatus={false}instead ofreadBy={0}.components/index.tsde-duplicated (6 exports appeared twice).An avatar rail keyed on each user's latest message is ~10 lines over public API (
useStateStore+snapshotStore.readersByMessageId), so no SDK hook was added for it.🎨 UI Changes
Older own messages now show the correct tick. No layout change —
CheckAllandCheckare both16×16in the same container.🧪 Testing
MessageStatus.test.tsx: 9 tests, icon/a11y matrix plus the reactive path driven throughmessageReceiptsTracker. The monotonicity test is negative-checked — reverting the hook toreadersByMessageId[id].length > 1fails exactly that test.receiptUserHooks.test.tsx: 3 tests for the restored at-or-past contract, including the regression case.yarn buildpasses. Not yet device-verified.☑️ Checklist
developbranch — targetsV10