Skip to content

Cluster Item Update removes marker (Disappears) #573

Description

@binayshaw7777

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<T>) = 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

// 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()
// 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.

Cluster.Item.Update.Issue.mp4

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions