https://kotlinlang.org logo
Title
a

Abhinav Sharma

05/09/2022, 8:25 AM
Question: Can Coil ignore the subsequent calls with same url until first call is success? Scenario:
@Composable
fun Foo() {
  // call to load image from coil
}
Foo makes image call when on its first composition and due to any reason if Foo is recomposed before first call could be a success Coil makes another image load call Is there a way to avoid this? cc @Colin White
@theapache64
m

myanmarking

05/09/2022, 9:12 AM
Try to make it a separate composable with url as parameters and check
c

Colin White

05/09/2022, 5:00 PM
If the URL doesn’t change it shouldn’t start a new request. Coil only starts a new request if the
hashCode
of the request (or the URL) changes: https://github.com/coil-kt/coil/blob/main/coil-compose-base/src/main/java/coil/compose/AsyncImagePainter.kt#L245
👍🏼 1
👍 1
a

Abhinav Sharma

05/10/2022, 4:40 AM
@Gagan Deep ☝️