qdsfdhvh / compose-imageloader

Compose Image library for Kotlin Multiplatform.
https://qdsfdhvh.github.io/compose-imageloader/
MIT License
425 stars 15 forks source link

AutoSizeBox not re-rendering when url changes #469

Closed joreilly closed 7 months ago

joreilly commented 7 months ago

Hi, I'm using version 1.7.6 and AutoSizeBox and it's not rendering new image when the url changes. I only seem to be seeing this though in the Compose for Desktop client. It should be possible to see this happening by running that client in https://github.com/joreilly/Confetti. The following is how it's used so maybe something I'm not doing correctly here (in SessionDetailsViewShared.kt)

                AutoSizeBox(speaker.photoUrl) { action ->
                    when (action) {
                        is ImageAction.Success -> {
                            Image(
                                rememberImageSuccessPainter(action), null,
                                modifier = Modifier.size(64.dp).clip(CircleShape),
                                contentScale = ContentScale.Crop,
                            )
                        }
                        is ImageAction.Loading -> {
                            CircularProgressIndicator()
                        }
                        is ImageAction.Failure -> {
                            Image(
                                painter = painterResource(Res.drawable.ic_person_black_24dp),
                                contentDescription = speaker.name,
                                contentScale = ContentScale.Fit,
                                modifier = Modifier.size(64.dp).clip(CircleShape)
                            )
                        }
                    }
                }
qdsfdhvh commented 7 months ago

It’s seem similar to my previous fix of AutoSizeImage, on desktop invalidateMeasurement will not trigger invalidateDraw. Can you help me to try AutoSizeImage can run fine? AutoSizeBox could also be for a more similar reason, but needs further investigation.

joreilly commented 7 months ago

Yes, AutoSizeImage works fine.