From 0182cea1a5c533a5f1b1a4a87d9737b6551e4532 Mon Sep 17 00:00:00 2001 From: Mustafa Ozhan Date: Sat, 14 Sep 2024 14:31:27 +0200 Subject: [PATCH] [Oztechan/CCC#3921] Update observed persisted values only inside observation block --- .../ccc/client/viewmodel/calculator/CalculatorViewModel.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/viewmodel/calculator/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/calculator/CalculatorViewModel.kt b/client/viewmodel/calculator/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/calculator/CalculatorViewModel.kt index 1a717eda2..c822040e8 100644 --- a/client/viewmodel/calculator/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/calculator/CalculatorViewModel.kt +++ b/client/viewmodel/calculator/src/commonMain/kotlin/com/oztechan/ccc/client/viewmodel/calculator/CalculatorViewModel.kt @@ -82,6 +82,7 @@ class CalculatorViewModel( .distinctUntilChanged() .onEach { Logger.d { "CalculatorViewModel observeBase $it" } + calculationStorage.currentBase = it currentBaseChanged(it) } .launchIn(viewModelScope) @@ -173,7 +174,6 @@ class CalculatorViewModel( private fun currentBaseChanged(newBase: String) = viewModelScope.launch { data.conversion = null - calculationStorage.currentBase = newBase val symbol = currencyDataSource.getCurrencyByCode(newBase)?.symbol.orEmpty() setState { copy(