vc=56 fixup: hoist hideShorts collectAsState out of LazyListScope

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.
This commit is contained in:
Kayos 2026-05-26 10:50:37 -07:00
parent 12acf41c08
commit 50f4ce0a6c

View file

@ -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,
@ -167,6 +171,7 @@ fun ChannelScreen(
}
}
}
}
@OptIn(ExperimentalFoundationApi::class)
@Composable