Christer Palm
02/17/2025, 5:24 PMfun Container.mainLoop() {
main().bind(store) { state ->
/* Render the view according to state */
}
}
I suppose the basic idea here is that the view is re-rendered whenever there is a state change(?)
The problem I'm having is that this happens asynchronously. The application goes through a number of state changes, but instead of re-rendering the page after each state change in realtime they queue up and after everything has settled, the page is re-rendered multiple times back-to-back, which is pointless.
The application really just needs to reflect the "final" state change.
Is this a bad pattern? Is there a better "best practice" approach to this?
Thanks!Robert Jaros
02/17/2025, 5:32 PMRobert Jaros
02/17/2025, 5:34 PMbindSync
extension function, which does this synchronously. You can try if that's better fit for your case.Robert Jaros
02/17/2025, 5:39 PMStateFlow
. It should work like this.Christer Palm
02/17/2025, 5:42 PMChrister Palm
02/17/2025, 5:43 PMChrister Palm
02/17/2025, 5:49 PMRobert Jaros
02/17/2025, 5:51 PMRobert Jaros
02/17/2025, 5:53 PMRobert Jaros
02/17/2025, 5:57 PMChrister Palm
02/17/2025, 7:36 PMRobert Jaros
02/17/2025, 8:04 PMRobert Jaros
02/17/2025, 8:06 PM