Francis Mariano
07/26/2023, 7:26 PMArkadii Ivanov
07/26/2023, 7:59 PMFrancis Mariano
07/26/2023, 8:07 PMFrancis Mariano
07/26/2023, 8:24 PMinit {
store.stateFlow.onEach {
logger.d { "$it" }
}.launchIn(scope)
}
override val states: StateFlow<AdvancedStore.State> = store.stateFlow
Nothing is logged here when I navigates to Store B and back to store A. When the Store B is popped and Store A is active again the main composable function is recomposed with the new state of store A even with no dispatcher called, no logger is called.
internal fun StroboAdvancedContent(component: AdvancedComponent) {
val state by component.states.collectAsState()
// here the state has the new state
}
Arkadii Ivanov
07/26/2023, 8:25 PMstates
property?Francis Mariano
07/26/2023, 8:26 PMArkadii Ivanov
07/26/2023, 8:26 PMstates
property.Francis Mariano
07/26/2023, 8:29 PMinterface AdvancedComponent {
val states: StateFlow<AdvancedStore.State>
}
internal class AdvancedComponentImpl(
private val componentContext: ComponentContext,
private val storeFactory: StoreFactory,
private val strobo: StroboRepository,
private val output: (Output) -> Unit,
private val channel: Int,
) : AdvancedComponent, ComponentContext by componentContext {
private val store =
instanceKeeper.getStore {
AdvancedStoreImpl(
storeFactory = storeFactory,
stroboRepository = strobo,
channel = channel,
).create()
}
@ExperimentalCoroutinesApi
override val states: StateFlow<AdvancedStore.State> = store.stateFlow
}
===============================
interface AdvancedEffectsComponent {
val states: StateFlow<AdvancedEffectsStore.State>
}
internal class AdvancedEffectsComponentImpl(
private val componentContext: ComponentContext,
private val storeFactory: StoreFactory,
private val strobo: StroboRepository,
private val output: (AdvancedEffectsComponent.Output) -> Unit,
private val channel: Int,
private val indexEffect: Int,
) : AdvancedEffectsComponent, ComponentContext by componentContext {
private val store =
instanceKeeper.getStore {
AdvancedEffectsStoreImpl(
storeFactory = storeFactory,
stroboRepository = strobo,
channel = channel,
indexEffect = indexEffect,
).create()
}
@ExperimentalCoroutinesApi
override val states: StateFlow<AdvancedEffectsStore.State> = store.stateFlow
}
Arkadii Ivanov
07/26/2023, 9:03 PMArkadii Ivanov
07/26/2023, 9:06 PMArkadii Ivanov
07/26/2023, 9:08 PMArkadii Ivanov
07/26/2023, 9:10 PMFrancis Mariano
07/27/2023, 11:25 AMFrancis Mariano
07/27/2023, 2:07 PMFrancis Mariano
07/27/2023, 2:10 PMArkadii Ivanov
07/27/2023, 3:14 PMinit
section to see where it gets created. I'm on vacation currently, not sure when I'll be able to check. Sorry.Francis Mariano
07/27/2023, 3:31 PMArkadii Ivanov
07/27/2023, 3:37 PMFrancis Mariano
09/01/2023, 4:56 PMArkadii Ivanov
09/01/2023, 5:03 PMArkadii Ivanov
09/01/2023, 5:06 PMArkadii Ivanov
09/01/2023, 5:13 PMFrancis Mariano
09/01/2023, 8:14 PM