From cbce49e7f7860e229df37826a451e5b1c433190e Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 7 Aug 2019 14:45:21 +0200 Subject: [PATCH] noStateLoaded must be called even if store loading is disabled GitOrigin-RevId: 4bf5dd70cdc8bebd0020c2fc278038fa43816a46 --- .../src/ComponentStoreImpl.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/platform/configuration-store-impl/src/ComponentStoreImpl.kt b/platform/configuration-store-impl/src/ComponentStoreImpl.kt index a9ea82d0001a..c7a4fbab134c 100644 --- a/platform/configuration-store-impl/src/ComponentStoreImpl.kt +++ b/platform/configuration-store-impl/src/ComponentStoreImpl.kt @@ -349,9 +349,15 @@ abstract class ComponentStoreImpl : IComponentStore { } private fun initComponent(info: ComponentInfo, changedStorages: Set?, reloadData: ThreeState): Boolean { + @Suppress("UNCHECKED_CAST") + val component = info.component as PersistentStateComponent return when { - loadPolicy == StateLoadPolicy.NOT_LOAD -> false - doInitComponent(info, changedStorages, reloadData) -> { + loadPolicy == StateLoadPolicy.NOT_LOAD -> { + @Suppress("UNCHECKED_CAST") + component.noStateLoaded() + false + } + doInitComponent(info, component, changedStorages, reloadData) -> { // if component was initialized, update lastModificationCount info.updateModificationCount() true @@ -360,10 +366,9 @@ abstract class ComponentStoreImpl : IComponentStore { } } - private fun doInitComponent(info: ComponentInfo, changedStorages: Set?, reloadData: ThreeState): Boolean { + private fun doInitComponent(info: ComponentInfo, component: PersistentStateComponent, changedStorages: Set?, reloadData: ThreeState): Boolean { val stateSpec = info.stateSpec!! - @Suppress("UNCHECKED_CAST") - val component = info.component as PersistentStateComponent + val name = stateSpec.name @Suppress("UNCHECKED_CAST") val stateClass: Class = when (component) {