Skip to content

fix(chat): keep the unread divider out of the gap above an unsent message - #1671

Merged
bmc08gt merged 1 commit into
code/cashfrom
fix/chat-unread-divider-pending
Oct 5, 2026
Merged

bmc08gt merged 1 commit into
code/cashfrom
fix/chat-unread-divider-pending

Conversation

@bmc08gt

@bmc08gt bmc08gt commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

Fixes Bugsnag 6ac2ccde396a2e952063917a: IllegalArgumentException: Key "unread-divider" was already used in the transcript's LazyColumn (2026.9.4).

A pending or failed send is stored with messageId = -(now) and sorts among the newest rows. unreadDividerBetween places the divider by comparing id ranges, and its isFromSelf guard only covers the newer side of a gap. So the gap between an incoming message and an unsent row below it passed older <= readThrough and drew a divider, the real boundary drew a second, and both use the fixed key "unread-divider".

The event's log fits: two sends to the open chat failed with Denied, then two incoming messages landed before the crash.

An older row with no server id (messageId < 1) no longer takes the divider. Unsent rows are created after the boundary is resolved, so they sit above the real gap. If clock skew ever put one exactly at the real gap, that visit would show no divider rather than crash.

UnreadDividerPlacementTest gains a case with a failed send between two unread rows that expects one divider.

…sage

A pending or failed send is stored with messageId = -(now) and sorts among
the newest rows. unreadDividerBetween compares id ranges, so the gap between
an incoming message and an unsent row below it passed `older <= readThrough`
and drew a divider. The real boundary drew a second one, and both share the
key "unread-divider", which crashed the LazyColumn (Bugsnag
6ac2ccde396a2e952063917a, 2026.9.4: two sends failed with Denied, then two
incoming messages landed in the open chat).

An older row with no server id (messageId < 1) no longer takes the divider.
@bmc08gt bmc08gt self-assigned this Oct 5, 2026
@github-actions github-actions Bot added the type: fix Bug fix label Oct 5, 2026
@bmc08gt
bmc08gt merged commit 843549e into code/cash Oct 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant