After upgrade to 1.0.2 (from 1.0.0) it seems that ...
# compose
j
After upgrade to 1.0.2 (from 1.0.0) it seems that my Local stopped working (seems like the value is not changed in the child sub-tree)
Copy code
public enum class ContentEmphasis { Normal, Minor, Subtle, Disabled }
public val LocalContentEmphasis: ProvidableCompositionLocal<ContentEmphasis> = compositionLocalOf { ContentEmphasis.Normal }
then using it like this
Copy code
fun Foo(label: @Composable () -> Unit) {
    CompositionLocalProvider(LocalContentEmphasis provides ContentEmphasis.Minor) {
        label()
    }
}
seems that components in label doesn't have the value changed. Did something changed? Or is my code wrong in some way?
Ok, part of this issue causing this is that I have this explicitly defined in my Theme composable. So it seems that the "redefinition" does not work.
Seems that splitting multiple CompositionLocalProviders to one per local fix this:
Copy code
CompositionLocalProvider(
    LocalTextStyle provides OrbitTheme.typography.bodySmall,
    LocalContentColor provides OrbitTheme.colors.content.normal,
) {
    CompositionLocalProvider(
        LocalContentEmphasis provides if (enabled) ContentEmphasis.Minor else ContentEmphasis.Disabled,
    ) {
        description()
    }
}
Still, not able to reproduce in different project.
l
This is super weird and super interesting. I had problems myself with Locals today.
j
Here is a report. Currently it seems that behavior is changed per device. It works on some devices, it does not on others.
Would you describe your problems as similar?
l
I honestly did not investigate it that deeply but it may look similar, yes. I'm going to investigate a bit and I'll tell you!
🙏 1
j
Apart downgrading and hacks in the issue, also update to 1.1.0-alpha03 fixes this. It seems that 1.0.[12] is broken.
Ok, I believe this is not connected to Compose version, more in the issue (also with another repro)