fix(chat): don't freeze the author-info flag at first composition - #6544
fix(chat): don't freeze the author-info flag at first composition#6544AndyScherzinger wants to merge 1 commit into
Conversation
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/32587171033/artifacts/9479465400 |
1808f79 to
1215fb4
Compare
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/32625591738/artifacts/9489667473 |
The chat list content read ChatUiState.isOneToOneConversation - which,
despite its name, carries "show author avatars and names", i.e. the
negation of the conversation being one-to-one - through
remember { mutableStateOf(...) } without a key. That snapshots the
field at the very first composition and never updates it again, so the
value only ends up correct when the conversation emission from the
database happens to win the race against the ComposeView's initial
composition.
Since the room list, chat opening and message prefetching moved onto
local database flows, a chat opens straight from the cache and the
first composition reliably runs before the conversation state lands.
The flag then stays frozen at its default false and group chats render
every incoming message without the author's avatar and display name.
Read the flag directly from the collected uiState instead, so the
message list recomposes with the real value once the conversation
arrives. Also drop the debug log that would otherwise print on every
recomposition.
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1215fb4 to
6a8c02b
Compare
|
APK file: https://github.com/nextcloud/talk-android/actions/runs/32626458502/artifacts/9489911495 |
Fixes group chats rendering incoming messages without the author's avatar and display name since the recent room-list/prefetching changes.
Root cause
ChatActivity.setChatListContent()readChatUiState.isOneToOneConversation— which, despite its name, carries "show author avatars and names", i.e.!conversation.isOneToOneConversation()as set inChatViewModel.observeConversation()— throughremember { mutableStateOf(uiState.isOneToOneConversation) }without a key. That snapshots the field at the very first composition and never updates it again.Whether that snapshot was correct was a race: it only held the real value when the conversation emission from the database reached
uiStatebefore the ComposeView's initial composition. Since the conversation list, chat opening and message prefetching moved onto local database flows (#6454, #6498), a chat opens straight from the cache and the first composition reliably runs before the conversation state lands — the flag stays frozen at its defaultfalse, andMessageScaffold(incoming && isOneToOneConversation && !isGrouped) never shows the avatar or the author name in group chats. The conversation-avatar caching (#6499) is not directly involved; chat-message avatars use the default Coil loader.Fix
Read the flag directly from the collected
uiState, so the message list recomposes with the real value once the conversation arrives. Also drops the debug log that would otherwise print on every recomposition.Possible follow-up (deliberately out of scope for this fix): the field's inverted naming —
isOneToOneConversationholding "is NOT one-to-one" acrossChatUiState,ChatViewState,ChatMessageContextand the message composables — is what made this freeze hard to spot and is worth a rename.🖼️ Screenshots
To be added during manual verification — the fix was developed in a remote environment without an emulator or test server, so no genuine screenshots could be captured. Expected: before, a group chat shows incoming messages without avatar/author name; after, ungrouped incoming messages show both.
🚧 TODO
🏁 Checklist
ChatActivity/backport to stable-xx.x🤖 AI (if applicable)
🤖 Generated with Claude Code
https://claude.ai/code/session_01Nz3sNhRhLG4zkwVULowGW5