Fix derivedStateOf errors (#8008)

This commit is contained in:
Ivan Iskandar
2022-09-14 22:36:13 +07:00
committed by GitHub
parent 82cd316493
commit 6865c21c75
5 changed files with 14 additions and 33 deletions
@@ -11,7 +11,6 @@ import androidx.compose.material3.SnackbarHostState
import androidx.compose.material3.SnackbarResult
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
@@ -111,13 +110,6 @@ class MangaController : FullComposeController<MangaPresenter> {
return
}
val dialog by derivedStateOf {
when (val state = state) {
MangaScreenState.Loading -> null
is MangaScreenState.Success -> state.dialog
}
}
val successState = state as MangaScreenState.Success
val isHttpSource = remember { successState.source is HttpSource }
val scope = rememberCoroutineScope()
@@ -152,7 +144,7 @@ class MangaController : FullComposeController<MangaPresenter> {
)
val onDismissRequest = { presenter.dismissDialog() }
when (val dialog = dialog) {
when (val dialog = (state as? MangaScreenState.Success)?.dialog) {
is Dialog.ChangeCategory -> {
ChangeCategoryDialog(
initialSelection = dialog.initialSelection,