From 706ce1d0cdd6fa099a384946c189ce690fe34379 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Tue, 6 Feb 2024 15:33:03 +0100 Subject: [PATCH] Do not use a key for the LazyColumn, or the scroll will not behave as expected if a room is moved to the top of the list. --- .../io/element/android/features/roomlist/impl/RoomListView.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt index 929d2550a4..ace8b9ce60 100644 --- a/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt +++ b/features/roomlist/impl/src/main/kotlin/io/element/android/features/roomlist/impl/RoomListView.kt @@ -259,10 +259,11 @@ private fun RoomListContent( } val roomList = state.roomList.dataOrNull().orEmpty() + // Note: do not use a key for the LazyColumn, or the scroll will not behave as expected if a room + // is moved to the top of the list. itemsIndexed( items = roomList, contentType = { _, room -> room.contentType() }, - key = { _, room -> room.roomId.value } ) { index, room -> RoomSummaryRow( room = room,