Skip to content

Commit 3b12a24

Browse files
authored
fix: avoid ComposeNotIdleException when clusterContent is null (#855)
1 parent 4dd0dd6 commit 3b12a24

File tree

1 file changed

+10
-2
lines changed
  • maps-compose-utils/src/main/java/com/google/maps/android/compose/clustering

1 file changed

+10
-2
lines changed

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
@@ -94,9 +94,17 @@ internal class ComposeUiClusterRenderer<T : ClusterItem>(
9494
*/
9595
private fun Cluster<T>.computeViewKeys(): Set<ViewKey<T>> {
9696
return if (shouldRenderAsCluster(this)) {
97-
setOf(ViewKey.Cluster(this))
97+
if (clusterContentState.value != null) {
98+
setOf(ViewKey.Cluster(this))
99+
} else {
100+
emptySet()
101+
}
98102
} else {
99-
items.mapTo(mutableSetOf()) { ViewKey.Item(it) }
103+
if (clusterItemContentState.value != null) {
104+
items.mapTo(mutableSetOf()) { ViewKey.Item(it) }
105+
} else {
106+
emptySet()
107+
}
100108
}
101109
}
102110

0 commit comments

Comments
 (0)