Dominaezzz
12/06/2020, 5:18 PMonDispose
for remember
?Adam Powell
12/06/2020, 5:22 PMCompositionLifecycleObserver.onLeave
- if remember
yields an object that implements CompositionLifecycleObserver
then it'll get the onLeave
call after a successful composition where it was previously present and then left.Adam Powell
12/06/2020, 5:23 PMremember
block was originally called fails, since a resulting CompositionLifecycleObserver
didn't successfully enter the composition in the first placeAdam Powell
12/06/2020, 5:25 PMremember
doesn't directly allocate resources that need to be explicitly cleaned up later. Instead, remember
an object that is safe to GC without explicit disposal and either have that object implement CompositionLifecycleObserver
to allocate/dispose those resources in `onEnter`/`onLeave` respectively, or use DisposableEffect(theObject)
to allocate/dispose those resourcesAdam Powell
12/06/2020, 5:25 PMLaunchedEffect(theObject)
if suspending semantics make more sense for dealing with cleanup for the particular use case)Dominaezzz
12/06/2020, 5:28 PMclose
to cancel the coroutine scope in it, but it looks like using rememberCoroutineScope
might be a better approach for the time being.Dominaezzz
12/06/2020, 5:28 PMAdam Powell
12/06/2020, 5:29 PMrememberCoroutineScope
suffers from this gotcha already so when we fix it there you'll inherit the fix 🙃Dominaezzz
12/06/2020, 5:30 PMzsperske
12/06/2020, 6:50 PMAlexjlockwood
12/06/2020, 7:46 PMAdam Powell
12/06/2020, 8:39 PMDominaezzz
01/22/2021, 10:19 PMRememberObserver
solve this completely?Adam Powell
01/22/2021, 10:20 PMDominaezzz
01/22/2021, 10:51 PM