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) 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(), modifier = Modifier.fillMaxSize().statusBarsPadding(),
contentPadding = rememberBottomContentPadding(), contentPadding = rememberBottomContentPadding(),
) { ) {
@ -145,10 +153,6 @@ fun ChannelScreen(
} }
HorizontalDivider() 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 -> items(filteredVideos) { item ->
ChannelVideoRow( ChannelVideoRow(
item = item, item = item,
@ -165,6 +169,7 @@ fun ChannelScreen(
HorizontalDivider() HorizontalDivider()
} }
} }
}
} }
} }