MarkerInfoWindow skips recomposition
See original GitHub issueEnvironment details
- Maps-Compose v1.2.0
Steps to reproduce
- Declare a state that should be updated inside a MakerInfoWindow
- Update the state
- MakerInfoWindow will not update
Code example
@Composable
fun MapTest() {
val empireStateBuilding = LatLng(40.7481672, -73.9859298)
var uiSettings by remember { mutableStateOf(MapUiSettings()) }
var properties by remember {
mutableStateOf(
MapProperties(mapType = MapType.SATELLITE)
)
}
var downloaded by remember { mutableStateOf(false) }
var cameraPosition = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(empireStateBuilding, 20f)
}
Box {
GoogleMap(
modifier = Modifier.fillMaxSize(),
properties = properties,
uiSettings = uiSettings,
cameraPositionState = cameraPosition
) {
MarkerInfoWindow(
position = empireStateBuilding,
title = "Empire State Building"
) {
Card(modifier = Modifier.size(width = 200.dp, height = 200.dp)) {
Column(modifier = Modifier.fillMaxSize()) {
Text(text = it.title!!)
Text("Downloaded: $downloaded")
Box(modifier = Modifier.size(100.dp)
) {
Image(
rememberImagePainter(data = "https://www.esbnyc.com/sites/default/files/a1r4P000009TJmGQAW.jpg",
onExecute = { previous, current ->
println("[LOG] Callback")
current.state == ImagePainter.State.Empty || previous?.request != current.request
}
) {
listener(object : ImageRequest.Listener {
override fun onCancel(request: ImageRequest) {
println("[LOG] onCancel")
}
override fun onError(
request: ImageRequest,
throwable: Throwable
) {
println("[LOG] onError: $throwable")
}
override fun onStart(request: ImageRequest) {
println("[LOG] onStart")
}
override fun onSuccess(
request: ImageRequest,
metadata: ImageResult.Metadata
) {
println("[LOG] onSuccess")
println("[LOG] downloaded: $downloaded")
downloaded = true
println("[LOG] downloaded: $downloaded")
}
})
},
contentDescription = it.title,
)
}
}
}
}
}
Text(
"Downloaded: $downloaded",
style = MaterialTheme.typography.h4,
color = Color.Red
)
}
}
Screen recording of the issue
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Jetpack Compose Smart Recomposition - Stack Overflow
To have smart recomposition scopes play a pivotal role. You can check Vinay Gaba's What is “donut-hole skipping” in Jetpack Compose? article ...
Read more >MarkerInfoWindowContent - Google Maps API Libraries
MarkerInfoWindow Content ... A composable for a marker on the map wherein its info window contents can be customized. If this customization is...
Read more >Jetpack Compose: Debugging Recomposition - Medium
Using the Layout Inspector in Android Studio, we can see the recomposition and skip counts of composable functions. If we go to the...
Read more >towards_left duff_s mdbg holt_winters gai incl_tax drupal_fapi ...
skips liftio disallows cellrenderercombo xquery automappings payments attibute const_qualified ... recomposition lineage ... markerinfowindow preamble.
Read more >Jetpack Compose: Debugging recomposition - YouTube
Why does deferring state reads into a lambda mean composition can be skipped ? A look into how debugging a performance issue in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
looking to use compose maps, but cant until we can have the composable actually refresh cause we are loading in images by url into the MarkerInfoWindow
Any updates or work around until it get fixed?