Pavel S
06/02/2024, 4:16 PMlabels
when the label is published immediately on store startup. I’ve modified my previous sample to illustrate the issue. I expect to see “a” in the first text and “bb” in the second text. AStore
dispatches an Action.PublishLabel
in the bootstrapper, and the action handler publishes Label.LabelPublished
. I subscribe to labels
in the init block of DefaultWelcomeComponent
but the label event is never received. But if you add a delay(<long>)
call before the publish
call, the label event is received. I initially thought this had something to do with the order of initialization of all the objects, but it seems that wasn’t the case, since if you use labels(observer: Observer<Label>): Disposable
the label event is still received. How would you suggest to deal with this?Arkadii Ivanov
06/02/2024, 5:11 PMyield
from a coroutine before publishing), or initialise (bootstrap) the store manually.
For the latter, see "Initializing a Store" here: https://arkivanov.github.io/MVIKotlin/store.htmlPavel S
06/02/2024, 5:29 PMStore.init()
be called in this example?Arkadii Ivanov
06/02/2024, 5:29 PMPavel S
06/02/2024, 5:36 PMautoInit = false
, and added the store.init()
here, but nothing changedArkadii Ivanov
06/02/2024, 5:38 PMPavel S
06/02/2024, 5:38 PMArkadii Ivanov
06/02/2024, 5:39 PMPavel S
06/02/2024, 5:44 PMDispatchers.Main.immediate
even with autoInit = true
Arkadii Ivanov
06/02/2024, 5:44 PM