I'm using com.google.maps.android:maps-compose:5.0.3 with build.gradle.kts in Kotlin 2.0 and latest compiler and Compose.
I'm developing an app where I attached a marker to each object I'm giving as input to a Composable which calls GoogleMap composable.
I'm composing MarkerComposable in two ways:
All objects as input that the user hasn't selected
The object as input the user has selected
To complicate a bit things, I am keeping state regarding which object is the currently selected one in ViewModel.
When a user clicks on the marker in the Map in UI on the device (Android phone, for example), the currently selected object is updated to that marker.
I was updating state even if the Marker was currently the selected one. Removing this code and leaving code to update the currently selected object only in MarkerComposable that are not matching the currently selected seems to have solved the issue where duplicate MarkerComposable were created.
As this is a strange fix for me and one that doesn't really make sense, I've to ask: does GoogleMap call onClick on MarkerComposable during composition?
Hi,
I'm using
com.google.maps.android:maps-compose:5.0.3
withbuild.gradle.kts
in Kotlin 2.0 and latest compiler and Compose.I'm developing an app where I attached a marker to each object I'm giving as input to a Composable which calls GoogleMap composable.
I'm composing
MarkerComposable
in two ways:To complicate a bit things, I am keeping state regarding which object is the currently selected one in ViewModel.
When a user clicks on the marker in the Map in UI on the device (Android phone, for example), the currently selected object is updated to that marker.
I was updating state even if the Marker was currently the selected one. Removing this code and leaving code to update the currently selected object only in
MarkerComposable
that are not matching the currently selected seems to have solved the issue where duplicateMarkerComposable
were created.As this is a strange fix for me and one that doesn't really make sense, I've to ask: does GoogleMap call onClick on MarkerComposable during composition?