question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MarkerInfoWindow skips recomposition

See original GitHub issue

Environment details

  1. Maps-Compose v1.2.0

Steps to reproduce

  1. Declare a state that should be updated inside a MakerInfoWindow
  2. Update the state
  3. 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
        )
    }
}

Sample Project attached

Screen recording of the issue

Screen recording of the issue

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
joshrvezycommented, Jul 11, 2022

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

0reactions
ravirajcmcommented, Jun 17, 2022

Any updates or work around until it get fixed?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found