mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 22:36:26 +02:00
Avoids changing the position of the the list when the list updates.
This commit is contained in:
@@ -78,15 +78,9 @@ fun ThreadFeedView(noteId: String, viewModel: FeedViewModel, accountViewModel: A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
is FeedState.Loaded -> {
|
is FeedState.Loaded -> {
|
||||||
var noteIdPositionInThread by remember { mutableStateOf(0) }
|
LaunchedEffect(noteId) {
|
||||||
// only in the first transition
|
val noteForPosition = state.feed.value.filter { it.idHex == noteId}.firstOrNull()
|
||||||
LaunchedEffect(noteIdPositionInThread) {
|
listState.animateScrollToItem(state.feed.value.indexOf(noteForPosition), 0)
|
||||||
listState.animateScrollToItem(noteIdPositionInThread, 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
val notePosition = state.feed.value.filter { it.idHex == noteId}.firstOrNull()
|
|
||||||
if (notePosition != null) {
|
|
||||||
noteIdPositionInThread = state.feed.value.indexOf(notePosition)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
|
Reference in New Issue
Block a user