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
Fix sharing composition locals with new platform layers #1086
Conversation
@@ -159,6 +171,7 @@ internal fun rememberComposeSceneLayer( | |||
val density = LocalDensity.current | |||
val layoutDirection = LocalLayoutDirection.current | |||
val parentComposition = rememberCompositionContext() | |||
val compositionLocalContext by rememberUpdatedState(currentCompositionLocalContext) |
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.
It's already contained inside parentComposition
that we already passing, but it's internal to runtime, so we cannot receive it from there.
At the same time, we must create a new composition for layers since it has different scope/invalidations/etc
So for now we have to pass it separately 😞
Proposed Changes
CompositionLocalContext
to all layersTesting
Test: unit tests currently runs without platform layers, so existing tests didn't find this issue (TODO). Added a separate page to mpp demo for manual testing for now.
Issues Fixed
Fixes JetBrains/compose-multiplatform#4281