Skip to content

Commit

Permalink
Fix: Reseting sort/filter model on start
Browse files Browse the repository at this point in the history
  • Loading branch information
machiav3lli committed Dec 10, 2024
1 parent b29ff7e commit 600bc54
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -97,15 +98,19 @@ fun SortFilterSheet(
val context = LocalContext.current
val nestedScrollConnection = rememberNestedScrollInteropConnection()
val packageList by viewModel.notBlockedList.collectAsState()
var model by rememberSaveable {
val state by remember(sourcePage) {
mutableStateOf(
when (sourcePage) {
NavItem.Backup -> viewModel.backupState
NavItem.Restore -> viewModel.restoreState
else -> viewModel.homeState // NavItem.Home
}.value.sortFilter
}
)
}
val stateModel by state.collectAsState()
var model by rememberSaveable(stateModel.sortFilter) {
mutableStateOf(state.value.sortFilter)
}

fun currentStats() = getStats(
packageList.applyFilter(
Expand Down

0 comments on commit 600bc54

Please sign in to comment.