Skip to content

Commit

Permalink
fix: ArtworkAsyncImage not being reloaded when a new image path is given
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Fontán <[email protected]>
  • Loading branch information
BobbyESP committed May 4, 2024
1 parent bb280b2 commit 0687d55
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,23 @@ fun ArtworkAsyncImage(
) {
var showArtwork by remember { mutableStateOf(true) }

if (artworkPath != null && showArtwork) {
val model by remember(artworkPath) {
mutableStateOf(artworkPath)
}

LaunchedEffect(model) {
showArtwork = model != null
}

if (model != null && showArtwork) {
Box(
modifier = modifier,
contentAlignment = Alignment.Center,
) {
AsyncImageImpl(
modifier = modifier
.clip(MaterialTheme.shapes.extraSmall),
model = artworkPath,
model = model!!,
onState = { state ->
//if it was successful, don't show the placeholder, else show it
showArtwork =
Expand Down

0 comments on commit 0687d55

Please sign in to comment.