Skip to content

Commit bce2c9d

Browse files
committed
fix: avoid ComposeNotIdleException when clusterContent is null
1 parent 62f4e43 commit bce2c9d

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

  • maps-compose-utils/src/main/java/com/google/maps/android/compose/clustering

maps-compose-utils/src/main/java/com/google/maps/android/compose/clustering/ClusterRenderer.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,17 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
8282
*/
8383
private fun Cluster<T>.computeViewKeys(): Set<ViewKey<T>> {
8484
return if (shouldRenderAsCluster(this)) {
85-
setOf(ViewKey.Cluster(this))
85+
if (clusterContentState.value != null) {
86+
setOf(ViewKey.Cluster(this))
87+
} else {
88+
emptySet()
89+
}
8690
} else {
87-
items.mapTo(mutableSetOf()) { ViewKey.Item(it) }
91+
if (clusterItemContentState.value != null) {
92+
items.mapTo(mutableSetOf()) { ViewKey.Item(it) }
93+
} else {
94+
emptySet()
95+
}
8896
}
8997
}
9098

0 commit comments

Comments
 (0)