Hi, I have a main screen that shows your status. You go off to other screens that update your status and then you return to the main screen. Problem is that I am not sure how to best refresh the status? No intents are firing on return (I think the last State is displayed but its no longer valid).
a
appmattus
12/03/2021, 2:11 PM
indeed, nothing will re-trigger on return
you can possibly use
repeatOnSubscription
inside the
onCreate
block which is cancelled when there are no subscribers to either
state
or
sideEffect
flows and re-executed when there is at least one subscriber to either, if that makes sense. something like:
Copy code
val container = container<…>(initialState {
repeatOnSubscription {
// this will (re-)execute every time there is at least one active subscriber
val result = lookupValue()
reduce { copy(result = result) }
}
}