From 50f4ce0a6c85dfaeb353204c0bd40c9341cebb6d Mon Sep 17 00:00:00 2001 From: Kayos Date: Tue, 26 May 2026 10:50:37 -0700 Subject: [PATCH] vc=56 fixup: hoist hideShorts collectAsState out of LazyListScope MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LazyColumn's content lambda is LazyListScope, NOT @Composable, so collectAsState() + remember() can't live inside the block body. Lift both above the LazyColumn call (still inside the when{}'s else branch). ChannelScreen — SubsPane and SearchScreen already had it in the right scope. --- .../sulkta/straw/feature/channel/ChannelScreen.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/strawApp/src/main/kotlin/com/sulkta/straw/feature/channel/ChannelScreen.kt b/strawApp/src/main/kotlin/com/sulkta/straw/feature/channel/ChannelScreen.kt index 3cb44dd45..bca2e6641 100644 --- a/strawApp/src/main/kotlin/com/sulkta/straw/feature/channel/ChannelScreen.kt +++ b/strawApp/src/main/kotlin/com/sulkta/straw/feature/channel/ChannelScreen.kt @@ -88,7 +88,15 @@ fun ChannelScreen( Text("error: ${state.error}", color = MaterialTheme.colorScheme.error) } - else -> LazyColumn( + else -> { + // Hoisted to outer Composable scope — LazyListScope is NOT + // @Composable so collectAsState / remember can't live inside + // the LazyColumn block. + val hideShorts by com.sulkta.straw.data.Settings.get().hideShorts.collectAsState() + val filteredVideos = remember(state.videos, hideShorts) { + com.sulkta.straw.util.applyContentFilters(state.videos, hideShorts = hideShorts) + } + LazyColumn( modifier = Modifier.fillMaxSize().statusBarsPadding(), contentPadding = rememberBottomContentPadding(), ) { @@ -145,10 +153,6 @@ fun ChannelScreen( } HorizontalDivider() } - val hideShorts by com.sulkta.straw.data.Settings.get().hideShorts.collectAsState() - val filteredVideos = remember(state.videos, hideShorts) { - com.sulkta.straw.util.applyContentFilters(state.videos, hideShorts = hideShorts) - } items(filteredVideos) { item -> ChannelVideoRow( item = item, @@ -165,6 +169,7 @@ fun ChannelScreen( HorizontalDivider() } } + } } }