Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Fix AppThemeItem
Browse files Browse the repository at this point in the history
- Optimize `ModuleItem`
  • Loading branch information
SanmerDev committed Jun 21, 2024
1 parent 4b12236 commit 4a6c80a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ internal fun ModuleItem(
val userPreferences = LocalUserPreferences.current
val menu = userPreferences.modulesMenu

val versionDisplay by remember {
val versionDisplay by remember(module) {
derivedStateOf { module.versionDisplay }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fun ModuleItem(
val ops by remember(module.state) {
derivedStateOf { getModuleOps(module) }
}
val item by remember {
val item by remember(module) {
derivedStateOf { getVersionItem(module) }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ private fun DarkModeItem(
darkMode: DarkMode,
onChange: (DarkMode) -> Unit
) {
val selected by remember { derivedStateOf { item.value == darkMode } }
val selected by remember(darkMode) {
derivedStateOf { item.value == darkMode }
}

Box(
modifier = Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,12 @@ private fun ThemeColorItem(
isDarkMode: Boolean,
onChange: (Int) -> Unit
) {
val selected by remember { derivedStateOf { id == themeColor } }
val selected by remember(themeColor) {
derivedStateOf { id == themeColor }
}

val color = Colors.getColor(id)
val colorScheme by remember {
val colorScheme by remember(isDarkMode) {
derivedStateOf {
when {
isDarkMode -> color.darkColorScheme
Expand Down

0 comments on commit 4a6c80a

Please sign in to comment.