Md. Nazmun Sadat Khan
11/24/2021, 3:50 AMAdam Powell
11/24/2021, 4:27 AM@Composable
fun Thing(state: ThingState) {
LaunchedEffect(state) {
state.keepUpdated()
}
// ...
}
ThingState
really smoothMd. Nazmun Sadat Khan
11/24/2021, 4:32 AMstate.keepUpdated
a suspend function and launch the coroutine from the composable, or is it better to make state.keepUpdated
a regular function and launch the coroutine inside the method.Adam Powell
11/24/2021, 4:34 AMMd. Nazmun Sadat Khan
11/24/2021, 4:42 AMCoroutineScope
via rememberCoroutineScope
in my composables.Adam Powell
11/24/2021, 4:51 AM@Composable
- it's one thing if it's in a click handler or something but composables are transactional and launching is a side effect that needs to be controlled to only escape composition if composition successfully commitsMd. Nazmun Sadat Khan
11/24/2021, 4:53 AMAdam Powell
11/24/2021, 5:40 AMMutatorMutex
exist; we encountered a lot of cases where a new actor in this kind of capacity needed to be able to kick out an old oneMd. Nazmun Sadat Khan
11/24/2021, 5:41 AMAdam Powell
11/24/2021, 5:42 AM