diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/FeedScreen.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/FeedScreen.kt index 7759865575..b4269a7745 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/FeedScreen.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/FeedScreen.kt @@ -436,7 +436,16 @@ fun FeedScreen( // not whatever DesktopPreferences happened to save last. If a caller // explicitly passes customFeedId/initialFeedMode, that always wins. val feedRepo = com.vitorpamplona.amethyst.desktop.ui.deck.LocalFeedRepository.current - val firstPinned = remember { feedRepo.pinnedFeeds.value.firstOrNull() } + // Read feeds.value (the source StateFlow that's loaded synchronously by + // FeedDefinitionRepository on construction) rather than pinnedFeeds.value — + // the latter is a stateIn-derived flow whose initial value is an empty list + // until the first flow emission propagates, which is too late for `remember`. + val firstPinned = + remember { + feedRepo.feeds.value + .filter { it.pinned } + .minByOrNull { it.pinOrder } + } val firstPinnedCustomSource = firstPinned?.source as? com.vitorpamplona.amethyst.commons.feeds.custom.FeedSource.Filter var activeFeedId by remember { diff --git a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/DeckColumnContainer.kt b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/DeckColumnContainer.kt index 90f0dbce05..7b673bf0e5 100644 --- a/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/DeckColumnContainer.kt +++ b/desktopApp/src/jvmMain/kotlin/com/vitorpamplona/amethyst/desktop/ui/deck/DeckColumnContainer.kt @@ -327,6 +327,8 @@ internal fun RootContent( when (columnType) { DeckColumnType.HomeFeed -> { + // Don't hardcode initialFeedMode — let FeedScreen pick the first + // pinned feed (Following/Global/Custom) as the default tab. FeedScreen( relayManager = relayManager, localCache = localCache, @@ -334,7 +336,6 @@ internal fun RootContent( iAccount = iAccount, nwcConnection = nwcConnection, subscriptionsCoordinator = subscriptionsCoordinator, - initialFeedMode = FeedMode.FOLLOWING, onCompose = onShowComposeDialog, onNavigateToProfile = onNavigateToProfile, onNavigateToThread = onNavigateToThread,