Slackbot
07/23/2026, 9:19 AMshikasd
07/24/2026, 2:03 AMshikasd
07/24/2026, 8:36 AMshikasd
07/24/2026, 1:27 PMefemoney
07/25/2026, 9:42 AMasSharedFlow() API to wrap a MutableSharedFlow so that the underlying object type is not mutable, is the same way the ProvidableCompositionLocal needs to be encapsulated so that its not mutable outside of the internal library.efemoney
07/25/2026, 8:06 PMChuck Jazdzewski [G]
07/30/2026, 8:56 PMval local = compositionLocalWithComputedDefaultOf {/* ... */}
CompositionLocalProvider(local provides x) {/* ... */}
In this example there is no difference between using compositionLocalOf() and compositionLocalWithComputedDefaultOf()
Where the two diverges is what happens when you don't provide local, what is the value of local? If a compositionLocalOf() composition local is not provided defaultValue is invoked (the first time, it is cached after that) and is returned as value. In compositionLocalWithComputedDefaultOf() the compute lambda is called every time but it is also a `CompositionLocalAccessorScope`so it can read other composition locals to produce its value.
An example of this use is, assume you have a holder of values (think Context in Android) but you want to surface parts of the holder as separate composition locals (such as default text direction). Before computed composition locals, you were required to provide each local separately. Now you can declare the individual holders as computed by default which will read the holder and return the value. Then providing a new holder all the individual locals will now report values from the new holder without requiring their being explicitly re-provided.Chuck Jazdzewski [G]
07/31/2026, 9:31 PM