Skip to content

Commit 714ea4f

Browse files
VelikovPetarclaude
andauthored
Fix auto scroll to bottom when exiting a thread (#6165)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3e3e389 commit 714ea4f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list

stream-chat-android-compose/src/main/java/io/getstream/chat/android/compose/ui/messages/list/Messages.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ internal fun BoxScope.DefaultMessagesHelperContent(
310310
// Keep track of the last new message state that triggered a scroll to bottom.
311311
// If a configuration change happens, we want to keep the same state
312312
// and not scroll to bottom again if the newMessageState is the same as before the configuration change.
313-
var lastScrollToBottomOnNewMessage by rememberSaveable(saver = MutableStateNewMessageStateSaver) {
313+
var lastScrollToBottomOnNewMessage by rememberSaveable(
314+
isMessageInThread,
315+
saver = MutableStateNewMessageStateSaver,
316+
) {
314317
mutableStateOf(newMessageState)
315318
}
316319

@@ -344,9 +347,7 @@ internal fun BoxScope.DefaultMessagesHelperContent(
344347
count = messagesState.unreadCount,
345348
onClick = {
346349
scrollToBottom {
347-
coroutineScope.launch {
348-
lazyListState.scrollToItem(0)
349-
}
350+
coroutineScope.launch { lazyListState.scrollToItem(0) }
350351
}
351352
},
352353
)

0 commit comments

Comments
 (0)