-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow an optional CoroutineContext to be supplied to launchMolecule. #312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we write a test? You can add an arbitrary key to the context and assert it's present in the composition for something that works on all platforms.
molecule-runtime/src/commonMain/kotlin/app/cash/molecule/molecule.kt
Outdated
Show resolved
Hide resolved
molecule-runtime/src/commonMain/kotlin/app/cash/molecule/molecule.kt
Outdated
Show resolved
Hide resolved
Just in case, you might want to rebase on master for the apiDump task would fail otherwise after merge |
Rebased onto master. |
molecule-runtime/src/commonMain/kotlin/app/cash/molecule/molecule.kt
Outdated
Show resolved
Hide resolved
public static final synthetic fun launchMolecule (Lkotlinx/coroutines/CoroutineScope;Lapp/cash/molecule/RecompositionMode;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;)V | ||
public static final synthetic fun launchMolecule (Lkotlinx/coroutines/CoroutineScope;Lapp/cash/molecule/RecompositionMode;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/StateFlow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff and the tool that produces it are really subpar, but these two lines are the same as the ones which were deleted except with synthetic
added (i.e., hiding them solely for binary compatibility). The new source-compatible versions are the two lines above and the synthetic functions for supporting their default argument values are the two lines below.
Allow an optional CoroutineContext to be supplied to launchMolecule.
This allows easier control of what dispatcher Molecule should run under in cases where we can't presume it's wired correctly in the provided CoroutineScope.