Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aync Image loading (Coil) is not working (Loader being cancelled) #542

Open
cwsiteplan opened this issue Apr 2, 2024 · 14 comments
Open
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@cwsiteplan
Copy link

Re-opening an issue here as this is still not resolved #385
Please provide any feedback - this is a blocker for us.

@cwsiteplan cwsiteplan added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Apr 2, 2024
@pioPirrung
Copy link

pioPirrung commented Apr 8, 2024

PR #538 seems to fix the cancellation issue. At least for me. I hope this helps

@cwsiteplan
Copy link
Author

thanks for the pointer - hopefully that gets merged soon!

@pioPirrung
Copy link

pioPirrung commented Apr 10, 2024

I hope so, this is blocking me too... I already asked at the PR if there's an update. So lets see how long this takes :shipit:

@cwsiteplan
Copy link
Author

i applied the fix from the PR locally - but works not all the time :/

@pioPirrung
Copy link

Are you using clustering? Because I do and it works every time. Even when fresh installing the application where the images are not cached yet and need to be fetched first

@cwsiteplan
Copy link
Author

@pioPirrung
just tried to replicate in the sample app and it's true - working fine now when using clusters - but using a simple MarkerComposable() it's still not loading (loader being cancelled)

i reproduced it here in the sample app (BasicMapActivity)
cwsiteplan#1

@pioPirrung
Copy link

PR #538 got merged and is available in version 4.4.1 FYI. Initially I thought the PR would fix both, but yes this isn't the case. Only fixes it for Clustering and MarkerComposable is still broke and needs to be fixed in another PR

@jialbanc
Copy link

Having same issue, any updates on resolving these??

@duranaustin
Copy link

Seeing this issue as well for MarkerComposable. Trying to load a Coil AsyncImage as a map Marker.

@jialbanc
Copy link

Any news on fixing this issue?? Please tell us about any updates

@AnaMaria-Birligea
Copy link

Same issue...

@ArleyPereira
Copy link

Same issue...

@squeezymo
Copy link

Same issue.

As a workaround, I'm hoisting marker ID and using it as a key to compose both a painter and a MarkerComposable. Otherwise images get messed up when the map recomposes.

key(markerId) {
    val painter = rememberAsyncImagePainter(
        ImageRequest.Builder(LocalContext.current)
            .data("https://...")
            .allowHardware(false)
            .build()
    )

    MarkerComposable(
        keys = arrayOf(painter.state),
        state = rememberMarkerState(position = LatLng(lat, lng)),
    ) {
        Image(
            painter = painter,
            contentDescription = null,
        )
    }
}

@AnaMaria-Birligea
Copy link

Same issue.

As a workaround, I'm hoisting marker ID and using it as a key to compose both a painter and a MarkerComposable. Otherwise images get messed up when the map recomposes.

key(markerId) {
    val painter = rememberAsyncImagePainter(
        ImageRequest.Builder(LocalContext.current)
            .data("https://...")
            .allowHardware(false)
            .build()
    )

    MarkerComposable(
        keys = arrayOf(painter.state),
        state = rememberMarkerState(position = LatLng(lat, lng)),
    ) {
        Image(
            painter = painter,
            contentDescription = null,
        )
    }
}

It works with this workaround. Thank you!

But we are still waiting for the fix in the library...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

7 participants