ribesg
10/17/2019, 8:46 AMribesg
10/17/2019, 8:49 AMuseEffectWithCleanup { { scope.cancel() } }
but it gets called on all state changesZachary Grafton
10/17/2019, 12:19 PMuseEffectWithCleanup(listOf()) { scope.cancel() }
Zachary Grafton
10/17/2019, 12:20 PMuseEffect
, it will be called on every state change unless you pass in an empty list of dependencies.Zachary Grafton
10/17/2019, 12:22 PMribesg
10/17/2019, 12:56 PMuseEffect
cleanup function is called. When I pass an empty list, it should not be called on component updates, just on mount and unmount. And maybe it works because cleanup isn’t called on mount, so it’s effectively only called on unmount. I used this to “get” a component-local coroutine scope https://github.com/Ribesg/Kita/blob/feature/init/modules/client/client-web/src/main/kotlin/fr/ribesg/kita/client/web/components/util/Coroutines.kt#L6