googlemaps / googlemaps/android-maps-compose
Cluster Item Update removes marker (Disappears)
- Dominant language
- Kotlin
- Stars
- 1.3k
- Forks
- 181
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
Hey,
I'm using Google Maps Compose along with Custom Cluster to render items on map, also I've the below property set to false
`override fun shouldRenderAsCluster(cluster: Cluster) = false`
On updating item from clustered/rendered items on the map, the desired updated marker disappears sometimes.
#### Environment details
1. `'com.google.maps.android:maps-compose:4.4.2'` and `'com.google.maps.android:maps-compose-utils:4.4.2'`
2. Android 12 (API 31) Physical Device for testing and Windows 10 Desktop
#### Steps to reproduce
1. Add some markers as cluster items in the map
2. Update marker(s) in the map (frequently)
3. The marker disappears unexpectedly
#### Code example
```kotlin
// COMPOSE VIEW
val itemToUpdate = clusterManager?.algorithm?.items?.find { it.getStation().id == 129 }
itemToUpdate?.station?.let { item ->
item.status = if (showFilterBottomSheet.value) "AVAILABLE" else "PLANNED"
}
itemToUpdate?.let {
val isUpdatedSuccess = clusterManager?.updateItem(it)
}
clusterManager?.cluster()
```
```kotlin
// CustomClusterRender
override fun onClusterItemUpdated(item: T, marker: Marker) {
super.onClusterItemUpdated(item, marker)
Timber.d("onClusterItemUpdated: ${item.title}")
marker.setIcon(
// Some internal logic to set marker color, also used in "onBeforeClusterItemRendered"
// FYI: setIcon internal logic doesn't have any issue.
)
}
```
Video Example:
NOTE: The marker disappears at `00:11` and I'm using the Filter Icon on the top right to trigger the update manually.
https://github.com/googlemaps/android-maps-compose/assets/62587060/76b5e753-d96a-4f37-ba71-8c5aa1deead0
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.