From 2377b023dc2ccf9f22aadf98fae260b4301df18a Mon Sep 17 00:00:00 2001 From: Nek-12 Date: Wed, 17 Apr 2024 00:57:42 +0300 Subject: [PATCH] fix readme sample app link, try to fix wasm saved state crash --- README.md | 4 ++-- .../features/savedstate/SavedStateContainer.kt | 15 +++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 211e788a..09c8f9ad 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ plugin system and a rich DSL. ## Quickstart: -* Sample App ![badge-wasm] : - [![Static Badge](https://img.shields.io/badge/Click_Me-Click_Me?style=flat&color=00b147)](https://opensource.respawn.pro/FlowMVI/sample) +* Sample App ![badge-wasm]: + [![Static Badge](https://img.shields.io/badge/Click_Me-Click_Me?style=flat&color=00b147)](https://opensource.respawn.pro/FlowMVI/sample/) * Documentation: [![Docs](https://img.shields.io/website?down_color=red&down_message=Offline&label=Docs&up_color=green&up_message=Online&url=https%3A%2F%2Fopensource.respawn.pro%2FFlowMVI%2F%23%2F)](https://opensource.respawn.pro/FlowMVI/#/) * KDoc: diff --git a/sample/src/commonMain/kotlin/pro/respawn/flowmvi/sample/features/savedstate/SavedStateContainer.kt b/sample/src/commonMain/kotlin/pro/respawn/flowmvi/sample/features/savedstate/SavedStateContainer.kt index 44cc775d..f9473613 100644 --- a/sample/src/commonMain/kotlin/pro/respawn/flowmvi/sample/features/savedstate/SavedStateContainer.kt +++ b/sample/src/commonMain/kotlin/pro/respawn/flowmvi/sample/features/savedstate/SavedStateContainer.kt @@ -27,12 +27,15 @@ internal class SavedStateContainer( // can also be injected, defined here for illustration purposes // see "StoreConfiguration" for injection setup - serializeState( - dir = fileManager.cacheDir("state") ?: "", - json = json, - serializer = DisplayingInput.serializer(), - recover = NullRecover, - ) + // Saved state is not supported on wasm yet + fileManager.cacheDir("state")?.let { + serializeState( + dir = it, + json = json, + serializer = DisplayingInput.serializer(), + recover = NullRecover, + ) + } reduce { intent -> when (intent) {