Hey, I’ve recently started using mvikotlin with de...
# mvikotlin
s
Hey, I’ve recently started using mvikotlin with decompose in a project, and run into an issue when using any
Bootstrapper
, but
SimpleBootstrapper
After configuration change this exception occurs on application launch:
Copy code
java.lang.IllegalStateException: Value is already initialized: Function1<Action, kotlin.Unit>
        at com.arkivanov.mvikotlin.utils.internal.AtomicExtKt.initialize(AtomicExt.kt:7)
        at com.arkivanov.mvikotlin.extensions.coroutines.SuspendBootstrapper.init(SuspendBootstrapper.kt:26)
        at com.arkivanov.mvikotlin.main.store.DefaultStore.<init>(DefaultStore.kt:58)
        at com.arkivanov.mvikotlin.main.store.DefaultStoreFactory.create(DefaultStoreFactory.kt:21)
Although this is easily avoided by using
SimpleBootstrapper
, I’m wondering is this behaviour intended or is there something that we have to do to prevent the exception from happening? The issue can be reproduced in decompose or mvikotlin sample app by replacing the
SimpleBootstrapper
by
Suspend/ReaktiveBootstrapper
a
Could you please show a code of the bootstrapper?
s
Copy code
private object BootstrapperImpl: SuspendBootstrapper<Unit>() {
    override suspend fun bootstrap() {
      dispatch(Unit)
    }
  }
or whatever is the alternative with
reaktive
a
Yeah, the bootstrapper must not be
object
. We should mention this in the docs. Contribution is welcome 😀
🙏🏼 2
Btw, how do you add Decompose to your project?
s
I’m using
includeBuild
for now, since I was tweaking some of the internals
I also wasn’t able to import it as a normal library, but I see that the issue is already filed
a
Yeah, I need to figure this out.
Thanks for your input!