https://kotlinlang.org logo
#compose
Title
# compose
d

Daniel Okanin

07/07/2022, 6:39 PM
EDIT: Hi everyone! I turn on the compiler flag for the compose metrics and I dont understand the following case- Why the VisibilityTrackerListener is unstable? is just an interface defines under module who run and compiled compose
Copy code
restartable scheme("[androidx.compose.ui.UiComposable]") fun ShoppingCarouselCardItem(
  stable card: ShoppingCarouselViewItem
  stable index: Int
  onClickListener: OnClickEvent? = @static null
  unstable carouselVisibilityTrackerListener: VisibilityTrackerListener<BaseEntry>? = @static null
  unstable onCarouselHidden: MutableLiveData<OnCarouselHidden>
e

ephemient

07/07/2022, 7:27 PM
https://medium.com/androiddevelopers/jetpack-compose-stability-explained-79c10db270c8
Classes from modules where the Compose compiler is not run are always determined to be unstable.
Guava isn't built with the Compose plugin (and isn't written in Kotlin), so it won't be recognized as immutable by Compose
l

liminal

07/07/2022, 7:27 PM
See if this answers your question https://issuetracker.google.com/issues/199496149 and you can always annotate your view model item with @immutable
d

Daniel Okanin

07/07/2022, 7:47 PM
Thanks @liminal and @ephemient . Why the VisibilityTrackerListener is unstable? is just an interface defines under module who run compose
Copy code
restartable scheme("[androidx.compose.ui.UiComposable]") fun ShoppingCarouselCardItem(
  stable card: ShoppingCarouselViewItem
  stable index: Int
  onClickListener: OnClickEvent? = @static null
  unstable carouselVisibilityTrackerListener: VisibilityTrackerListener<BaseEntry>? = @static null
  unstable onCarouselHidden: MutableLiveData<OnCarouselHidden>
e

ephemient

07/07/2022, 7:51 PM
it needs to be annotated and compiled with compose compiler plugin
d

Daniel Okanin

07/07/2022, 7:52 PM
it is
e

ephemient

07/07/2022, 7:52 PM
(or inferred instead of annotated)
hmm, maybe it doesn't play with generics, not sure.
d

Daniel Okanin

07/07/2022, 7:53 PM
ya I think so too…
s

shikasd

07/08/2022, 1:18 AM
I believe interfaces are not considered stable by default, but you can always annotate it as such
3 Views