From 8cd4914842f61c0c6b49e0216c7816e201a3c94a Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Wed, 18 Mar 2026 10:54:17 -0400 Subject: [PATCH] fix(17-02): refresh cover art URLs after save After a successful save, re-fetch albums alongside tracks and re-resolve cover art URLs from the updated album data. Previously the dialog only refreshed this.track but kept stale this.coverArt URLs pointing to the old content-hash files, causing the image to revert until reopen. --- .../components/track-details/track-details.ts | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/track-details/track-details.ts b/frontend/src/components/track-details/track-details.ts index 19bed28..90bd42f 100644 --- a/frontend/src/components/track-details/track-details.ts +++ b/frontend/src/components/track-details/track-details.ts @@ -823,17 +823,38 @@ export class TrackDetails extends LitElement { // invalidation, which refreshes all other views. this.exitEditMode(); - // Re-fetch the track data so the dialog shows - // updated values. The store invalidation is - // already in-flight from the event; getTracks() - // will either await the pending fetch or start one. - const tracks = await libraryStore.getTracks(); + // Re-fetch track and album data so the dialog + // shows updated values and cover art. The store + // invalidation is already in-flight from the event; + // these calls await the pending fetch or start one. + const [tracks, albums] = await Promise.all([ + libraryStore.getTracks(), + libraryStore.getAlbums(), + ]); + const updated = tracks.find( (t) => t.FilePath === filePath, ); if (updated) { this.track = updated; + + // Re-resolve cover art from the refreshed + // album data (URLs change on new content hash). + const album = albums.find( + (a) => a.Name === updated.Album, + ); + + if (album?.CoverArtPath) { + this.coverArt = { + coverArtPath: album.CoverArtPath, + coverArtSmall: album.CoverArtSmall, + coverArtMedium: album.CoverArtMedium, + coverArtLarge: album.CoverArtLarge, + }; + } else { + this.coverArt = null; + } } } catch (err: unknown) { const msg =