```Compose always considers unstable where they ar...
# compose-android
c
Copy code
Compose always considers unstable where they are from modules in which the Compose compiler does not run. Wrap the classes in UI model classes if required.
(https://developer.android.com/develop/ui/compose/performance/stability#summary) We’re integrating Multiplatform as a gradle dependency into at native Android app with Compose(not Multiplatform) - does that mean that using models from Multiplatform as parameters on Composable functions is a bad idea, since they’ll always be unstable?
s
You can always make any type considered stable by manually specifying it in the compiler configuration file. Or, if I’m not mistaken, this is no longer relevant now that strong skipping is enabled by default.
z
With strong skipping on, the compiler still treats stable and non-stable types differently: stable types are compared with
==
, non-stable are compared with
===
👍 4
d
Is the go-to solution that people use maintaining the configuration file manually? Is there anything neater that could be done (imo enabling the CMP compiler on the multiplatform module is worse, so that's not desired either)?
s
@Zach Klippenstein (he/him) [MOD] That makes me wonder though; wouldn't that make unstable type comparisons (given the reference didn't change) faster? Since it's just comparing two numbers (pointers)
z
The comparison might be faster, but it’s worth it if you are avoiding a recomposition, which is probably orders of magnitude more expensive than either comparison, in most cases
👍 1