View isn't updated after recomposition
I have seen it in more complex applications, but this is the easiest reproduction view:
@Composable
fun ClusterItemConversation() {
val x = remember { mutableIntStateOf(0) }
LaunchedEffect(key1 = Unit) {
// This just delays the execution
dispatchToMainThread(2000) {
x.value += 1
log { "Updated" }
}
}
Column(verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally) {
Text(text = x.value.toString())
}
}
// Some map code...
Clustering(items = clusterItems, clusterItemContent = { ci ->
ClusterItemConversation()
})
In the logging I can observe that Updated is there, but the view isn't updated at all, the text remains 0. The view is out of sync.
i think i have a similar issue.
the clusterItem is depending on state that is updated but using the clustering we're not able to specify a key like in the MarkerComposable() how are we supposed to define such state objects using a cluster?
i created a sample for my case here: https://github.com/googlemaps/android-maps-compose/compare/main...cwsiteplan:android-maps-compose:bug/cluster-item-update
i do have a mutable state that holds the ID of the selected marker.
but the clusterItemContent does not get recomposed, even though read state values do change.
@Composable
fun CustomRendererClustering(items: List<MyItem>, selectedId: String) {
...
clusterItemContent = {
CircleContent(
modifier = Modifier.size(20.dp),
text = "",
color = if (it.id == selectedId) Color.Red else Color.Green,
)
},
...
}
Same issue here. Any work around?
Any update on this?
Also looking for a solution for this please. Exact same issue as above, I have an isSelected boolean that is getting updated, but the view isn't getting recomposed.
Just encountered the same issue here. Can we at least have a workaround for the recomposition, like MarkerComposable did?
I also have this issue, I would like to update the clustered marker composables based on user interaction!
I had the same issue with maps-compose-utils version 4.3.2. Using version 4.2.0 works fine.
I have the same issue with maps-compose-utils version 4.3.3. Any work around except modify data in the items of Clustering composable?
Can we get an ETA of a potential fix? @kikoso
seems 4.4.0 is fixing this issue for me.
Hello, Any update on this?
Just encountered the same issue here. Can we at least have a workaround for the recomposition, like
MarkerComposabledid?
@yibene What's the workaround with MarkerComposable? I'm facing the said issue but with MarkerComposable
Just encountered the same issue here. Can we at least have a workaround for the recomposition, like
MarkerComposabledid?@yibene What's the workaround with
MarkerComposable? I'm facing the said issue but withMarkerComposable
Never mind, I used keys argument of MarkerComposable and it works seamlessly
Any updates to this issue, I'm facing the same with MarkerComposable
Hi folks,
This should have been fixed. Are you experiencing this on the MarkerComposable? In this case, what are you using in the keys parameter?