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:
parent
12acf41c08
commit
50f4ce0a6c
1 changed files with 10 additions and 5 deletions
|
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue