Merge pull request #1797 from vitorpamplona/claude/fix-search-scroll-position-U10Lv

Persist search screen scroll position across navigation
This commit is contained in:
Vitor Pamplona
2026-03-10 13:44:24 -04:00
committed by GitHub
2 changed files with 5 additions and 2 deletions
@@ -54,6 +54,8 @@ object ScrollStateKeys {
const val DISCOVER_LIVE = "DiscoverLiveFeed"
const val DISCOVER_COMMUNITY = "DiscoverCommunitiesFeed"
const val DISCOVER_CHATS = "DiscoverChatsFeed"
const val SEARCH_SCREEN = "SearchFeed"
}
object PagerStateKeys {
@@ -33,7 +33,8 @@ import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.foundation.lazy.rememberLazyListState
import com.vitorpamplona.amethyst.ui.feeds.ScrollStateKeys
import com.vitorpamplona.amethyst.ui.feeds.rememberForeverLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material3.HorizontalDivider
@@ -107,7 +108,7 @@ fun SearchScreen(
) {
WatchLifecycleAndUpdateModel(searchBarViewModel)
val listState = rememberLazyListState()
val listState = rememberForeverLazyListState(ScrollStateKeys.SEARCH_SCREEN)
LaunchedEffect(searchBarViewModel.focusRequester) {
searchBarViewModel.focusRequester.requestFocus()