Open BoD opened 3 months ago
I wonder if you should just rely on strong-skipping mode instead https://medium.com/androiddevelopers/jetpack-compose-strong-skipping-mode-explained-cbdb2aa4b900 and not have to worry about doing such optimizations on the apollo-kotlin end.
My understanding is that strong skipping will be enabled by default in the future and as long as the generated models generate proper .equals
functions, which they do, then it might just be fine to not do anything here
Thanks a lot for sharing, interesting stuff! From what I gather, it sounds like with this change, stability won't be as important as it was.
It still doesn't hurt and is pretty easy to mark all generated classes as stable with the configuration file. Maybe this ticket is just to document how to do this somewhere in our docs.
Yeah that is fair, as long as you do not mind having the annotation in the sources, and you anyway guarantee that those classes are immutable, then adding the annotation is also safe enough that it shouldn't matter.
But I agree with keeping the ticket open. Strong skipping mode isn't on by default yet anyway.
The models generated by Apollo Kotlin are immutable, and therefore should participate in skipping recomposition. However list fields are generated with
List<T>
which is considered unstable by Compose.More information about Compose stability here.
We could mark the generated models with
@Immutable
but that implies with a dependency toandroidx.compose.runtime:runtime
, so we would need to make this configurableIn the meantime users can already mark the generated models as stable manually with the Compose compiler configuration file
com.example.models.**
)