From ffcdc41b0d4fad8ed428dbaa55f6cdd38c096822 Mon Sep 17 00:00:00 2001 From: Caleb Allen Date: Wed, 18 Mar 2026 01:23:34 -0400 Subject: [PATCH] fix(17-02): refresh track-details dialog data after successful save After saveEdit() succeeds, re-fetch tracks from library store and update this.track with the fresh data so the dialog shows updated values instead of the stale snapshot passed via show(). --- .../components/track-details/track-details.ts | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/track-details/track-details.ts b/frontend/src/components/track-details/track-details.ts index 2711ab9..0a0f9b9 100644 --- a/frontend/src/components/track-details/track-details.ts +++ b/frontend/src/components/track-details/track-details.ts @@ -15,6 +15,7 @@ import { import { formatMilliseconds } from '@utils/time'; import { WriteTrackTagsByPath } from '@go/tagwriter/TagWriter'; import { ImageFilePicker, ReadFile } from '@go/frontendutil/FrontendUtil'; +import { libraryStore } from '../../store/library-store'; import '@awesome.me/webawesome/dist/components/dialog/dialog.js'; import '@awesome.me/webawesome/dist/components/icon/icon.js'; @@ -813,15 +814,27 @@ export class TrackDetails extends LitElement { return; } - await WriteTrackTagsByPath( - this.track.FilePath, - changes, - ); + const filePath = this.track.FilePath; + + await WriteTrackTagsByPath(filePath, changes); // Success — switch to read-only view. The // TrackMetadataChanged event triggers library store // 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(); + const updated = tracks.find( + (t) => t.FilePath === filePath, + ); + + if (updated) { + this.track = updated; + } } catch (err: unknown) { const msg = err instanceof Error