Skip to content

refactor: delivery receipts v10 - #3823

Merged
isekovanic merged 4 commits into
V10from
refactor/delivery-receipts-v10
Sep 23, 2026
Merged

isekovanic merged 4 commits into
V10from
refactor/delivery-receipts-v10

Conversation

@isekovanic

Copy link
Copy Markdown
Contributor

🎯 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.

MessageStatus read readersByMessageId[id], which answers "whose cursor stops here" (what positions a read avatar), not "who has read this" — and readBy > 1 assumed the current user was in that bucket. Both were correct in v8/v9, where the value came from readersForMessage; 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

  • Ticks come from lastReadRefByOthers / lastDeliveredRefByOthers (stream-chat 2 GIFs in one single message #1883, rc.13) via new useIsMessageReadByOthers / 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.
  • MessageStatus subscribes itself instead of receiving counts through MessageContext. Those counts had one consumer but sat on the context value, and React.memo can'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: useMessageContext calls per emit 26 → 2, receipts subscriptions 24 → 4, footer re-renders 1 → 0.
  • useMessageReadData / useMessageDeliveredData restored to readersForMessage / deliveredForMessage, in the v9 shape.
  • Integrates stream-chat Android - The pictures (available for the attachment) are disappeared suddenly. #1881 (two new CORE_NOTIFICATION_TYPE members) and Performance lag when trying to search a message in the Channel #1882 (send/retry split into distinct operation kinds).

API changes — all pre-release, the RN SDK has never published a v10:

  • readBy / deliveredToCount removed from MessageContextValue, MessageProps, MessageStatusPropsWithContext. MessageStatusProps is now { read?: boolean; delivered?: boolean }.
  • useMessageReadCount / useMessageDeliveredToCount deleted — zero consumers, never existed in v9, and their docs pointed at the bug above.
  • ThreadFooterComponent uses showMessageStatus={false} instead of readBy={0}.
  • components/index.ts de-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 — CheckAll and Check are both 16×16 in the same container.

Screenshots pending: needs a device pass with a second user reading back through a conversation.

🧪 Testing

  • MessageStatus.test.tsx: 9 tests, icon/a11y matrix plus the reactive path driven through messageReceiptsTracker. The monotonicity test is negative-checked — reverting the hook to readersByMessageId[id].length > 1 fails exactly that test.
  • receiptUserHooks.test.tsx: 3 tests for the restored at-or-past contract, including the regression case.
  • 204 suites / 1996 tests green, root typecheck 0 errors, yarn build passes. Not yet device-verified.

☑️ Checklist

  • I have signed the Stream CLA (required)
  • PR targets the develop branch — targets V10
  • Documentation is updated — breaking changes need a migration-guide pass
  • New code is tested in main example apps, including all possible scenarios
    • SampleApp iOS and Android
    • Expo iOS and Android

@Stream-SDK-Bot

Copy link
Copy Markdown
Contributor

SDK Size

title develop branch diff status
js_bundle_size 2031 KB 2036 KB +5208 B 🔴

@isekovanic
isekovanic merged commit 0f1c3c9 into V10 Sep 23, 2026
3 of 4 checks passed
@isekovanic
isekovanic deleted the refactor/delivery-receipts-v10 branch September 23, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants