feat: keep Public Chats scrolled to top when new top items arrive

When the first item of either the pinned or unpinned block changes,
animate-scroll back to index 0 if the user was at or near the very top.
This mirrors the pattern from ChatFeedView so a new chat bubbling up
doesn't leave the user one row below it.
This commit is contained in:
Claude
2026-05-21 21:09:49 +00:00
parent 5cdf69bb83
commit ee0b658401
@@ -35,6 +35,7 @@ import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@@ -77,6 +78,12 @@ fun PublicChatsFeedLoaded(
items.list.filter { it.idHex !in followedSet }
}
LaunchedEffect(pinned.firstOrNull()?.idHex, unpinned.firstOrNull()?.idHex) {
if (listState.firstVisibleItemIndex <= 1) {
listState.animateScrollToItem(0)
}
}
LazyColumn(
contentPadding = rememberFeedContentPadding(FeedPadding),
state = listState,