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.
This commit is contained in:
2026-03-18 10:54:17 -04:00
parent d7c2965752
commit 8cd4914842
@@ -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 =