From 26195e8d39117d6e70f07269d201ce94d4b69613 Mon Sep 17 00:00:00 2001 From: andrekir Date: Tue, 3 Oct 2023 17:05:56 -0300 Subject: [PATCH] refactor: use `rememberSaveable` for `showChannelEditor` --- app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt b/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt index acca4502b..752c4632d 100644 --- a/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt +++ b/app/src/main/java/com/geeksville/mesh/ui/ChannelFragment.kt @@ -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 @@ -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