Skip to content

Commit 3f71b0d

Browse files
fix(conversations): don't re-restore the scroll position on every resume
Returning from a chat to the conversation list made the list visibly jump shortly after rendering. The saved scroll position was re-armed on every resume and restored on the next room list emission - which used to be an immediate local snapshot, making the restore an invisible no-op. With the list derived reactively from the database, the state current at resume never re-emits, so the first post-resume emission is the server sync response seconds later: scrollToItem then re-anchored an already rendered (and possibly slightly changed) list under the user's eyes. Restore the position only once per activity lifetime: after a recreation the LazyListState is genuinely lost and the first emission - which the reactive flow now delivers immediately on subscription - restores it, while a plain resume keeps the retained state's position naturally, without any late scrollToItem. Assisted-by: Claude Code:claude-fable-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 parent 3ae3b1b commit 3f71b0d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎app/src/main/java/com/nextcloud/talk/conversationlist/ConversationsListActivity.kt‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class ConversationsListActivity : BaseActivity() {
160160
// Lazy list state – set from inside setContent, read from onPause
161161
private var conversationListLazyListState: androidx.compose.foundation.lazy.LazyListState? = null
162162

163-
// Ensures saved scroll position is restored only once per resume cycle, not on every room-list refresh.
163+
// restored once per activity lifetime; a late scrollToItem on resume would jump the rendered list
164164
private var scrollPositionRestored = false
165165

166166
private var nextUnreadConversationScrollPosition = 0
@@ -385,7 +385,6 @@ class ConversationsListActivity : BaseActivity() {
385385

386386
override fun onResume() {
387387
super.onResume()
388-
scrollPositionRestored = false
389388

390389
showNotificationWarningState.value = shouldShowNotificationWarning()
391390
showShareToScreenState.value = hasActivityActionSendIntent()

0 commit comments

Comments
 (0)