CLOVIS
12/24/2022, 6:20 PMCoroutineContext.Element
inside of Compose that would get passed down to all rememberCoroutineScope()
created by Compose?Dima Avdeev
12/24/2022, 6:43 PMrememberCoroutineScope(Job() + Dispatchers.Default)
CLOVIS
12/24/2022, 6:44 PMCoroutineContext
object that I would like automatically injected into all rememberCoroutineScope()
call without specifying it every timeCLOVIS
12/24/2022, 6:45 PMCoroutineScope
internally to trigger recomposition? Maybe rememberCoroutineScope
inherits its context from there?Dima Avdeev
12/24/2022, 6:57 PMDima Avdeev
12/24/2022, 7:16 PMval MyCoroutineContext = compositionLocalOf<CoroutineContext?>
• Provide this property on top of your App
CompositionLocalProvider(MyCoroutineContext provides Job("my additional context")) {
//your top level Compose App
}
• Add your helper function to simpy use this providen context in amy place:
@Composable fun rememberCoroutineScopeWithMyOwnContext():CoroutineContext {
rememberCoroutineScope(MyCoroutineContext.current)
}
After you can use rememberCoroutineScopeWithMyOwnContext() in any place you need.Dima Avdeev
12/24/2022, 7:18 PMefemoney
12/27/2022, 12:00 AMCLOVIS
12/27/2022, 8:44 AMAuth
class that stores the user ID, to avoid having to explicitly pass it to all components in the app. As a workaround I'll just add a withContext
in all the ClientService
method, but I would have preferred if it were globalCLOVIS
12/28/2022, 4:46 PMCoroutineExceptionHandler
as a last line of defense in case someone somewhere forgot to try-catch
in a button or something, instead of the current behavior (crashing CfW until the app is restarted)Kapil Yadav
08/12/2023, 6:41 PMCLOVIS
08/13/2023, 8:00 AM