fix: auto-scroll chat when messages exceed display limit
LaunchedEffect key was based on messages.size which stays constant at INITIAL_LOAD_COUNT (50) once the DB has enough messages. Use the latest message ID instead so the effect re-fires on every new message. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c7f6095904
commit
dda0dd9d5f
1 changed files with 1 additions and 1 deletions
|
|
@ -146,7 +146,7 @@ fun ChatScreen(
|
||||||
derivedStateOf { listState.firstVisibleItemIndex <= 3 }
|
derivedStateOf { listState.firstVisibleItemIndex <= 3 }
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(uiState.messages.size) {
|
LaunchedEffect(uiState.messages.firstOrNull()?.id) {
|
||||||
if (isNearBottom) {
|
if (isNearBottom) {
|
||||||
listState.animateScrollToItem(0)
|
listState.animateScrollToItem(0)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue