googlemaps / googlemaps/android-maps-compose

Polyline doesn't recompose when points change

Open
#105 9 comments 0 reactions 1 assignee Claimed by @barbeau View on GitHub
priority: p3 status: blocked type: bug
Dominant language
Kotlin
Stars
1.3k
Forks
181
Avg merge
2d 23h
Merged PRs (30d)
18

Description

#### Environment details

Android API 26
com.google.maps.android:maps-compose:2.1.0

#### Steps to reproduce

1. Create a map with a MutableStateList of points
2. Use the points to draw markers and a polyline between them
3. Add functionality to add or remove points from the list
4. Observe that the markers update, but the polyline does not

#### Code example

```
@Composable
fun MapScreen(){
val waypoints = remember{ mutableStateListOf()}
Map(waypoints) {
waypoints.add(it)
}
}

@Composable
private fun Map(
waypoints: List,
modifier: Modifier = Modifier,
onMapClicked: (latlng: LatLng) -> Unit
){
GoogleMap(
modifier = modifier,
onMapClick = onMapClicked,
){
waypoints.forEach {
Marker(state = MarkerState(position = it))
}
Polyline(waypoints)
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.