Skip to content

Commit

Permalink
refactor: use rememberSaveable for showChannelEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
andrekir committed Oct 3, 2023
1 parent 1185e38 commit 26195e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.asImageBitmap
Expand Down Expand Up @@ -142,7 +143,7 @@ fun ChannelScreen(

val channels by viewModel.channels.collectAsStateWithLifecycle()
var channelSet by remember(channels) { mutableStateOf(channels.protobuf) }
var showChannelEditor by remember { mutableStateOf(false) }
var showChannelEditor by rememberSaveable { mutableStateOf(false) }
val isEditing = channelSet != channels.protobuf || showChannelEditor

val primaryChannel = ChannelSet(channelSet).primaryChannel
Expand Down

0 comments on commit 26195e8

Please sign in to comment.