fix(chat): keep the unread divider out of the gap above an unsent message - #1671
Merged
Merged
Conversation
…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.
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.
Fixes Bugsnag 6ac2ccde396a2e952063917a:
IllegalArgumentException: Key "unread-divider" was already usedin the transcript's LazyColumn (2026.9.4).A pending or failed send is stored with
messageId = -(now)and sorts among the newest rows.unreadDividerBetweenplaces the divider by comparing id ranges, and itsisFromSelfguard only covers the newer side of a gap. So the gap between an incoming message and an unsent row below it passedolder <= readThroughand 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.UnreadDividerPlacementTestgains a case with a failed send between two unread rows that expects one divider.