Bug P4
Status Update
Comments
ti...@google.com <ti...@google.com>
jr...@gmail.com <jr...@gmail.com> #2
Great point on the regression between Merge! It’s crucial to ensure that foundational standards like ISO/IEC 27001 are added to solidify security and risk management. This certification helps organizations align with best practices, making it a vital step forward in maintaining robust data protection. Thanks for bringing that up! More Info:- https://riskprofs.com/product-category/trainings/information-security/iso-iec-27001/
Description
Jetpack Compose version: 1.7.6 (also tested 1.8.0-alpha08)
Jetpack Compose component(s) used: androidx.compose.foundation.lazy, androidx.compose.runtime.derivedStateOf
Android Studio Build: Build #AI-242.23726.103.2422.12816248, built on December 18, 2024
Kotlin version: 2.1.0
Steps to Reproduce or Code Sample to Reproduce:
First sticky header
andSome extension item
are constantly recomposedI am working with a LazyList that contains many items and some sticky headers. For my use case, I need to know when a specific stick header is actually sticking and change some UI component depending on that. To know when a header is sticking, I am using the snippet provided in this official sample that makes use of
derivedStateOf
(seeisHeaderSticky
).Additionally, I want to separate the components in my list by grouping them as the list is pretty big and crowded. To do so, I use
LazyListScope.someExtension()
that contains multipleitem
anditems
children.Both
derivedStateOf
andLazyListScope.someExtension()
work fine on their own and do what I would expect. However, if I use them in the same list, I experience constant recomposition of the items that read theisHeaderSticky
state and also constant recalculation of the derived state. The logcat output also shows constant repetition of### Some extension item
,### Calculating state
and### First sticky header
.When running the same code with
someExtension(isSticky = isHeaderSticky)
commented out, the recomposition and log outputs no longer happen. I also attached two videos showing the difference.I assume that the extension reads the state in a way that messes up the Compose state handling mechanism. But is this expected behavior? What would you recommend instead if I want to separate out parts of my list in groups of multiple items?
Reproducer example: