From a1d7c408ec26ed7a98be187959c121a0cb67ab15 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Mon, 15 Jun 2026 22:44:57 +0200 Subject: [PATCH] fix(playlists): show Reset/Unsynced right after a reorder A reorder only invalidated the sidebar query, so detail.dirty stayed stale and the Reset to YouTube button + Unsynced indicator appeared only after F5. Also invalidate the detail query on reorder; the membership guard keeps the refetch from wiping the undo history on a pure reorder. --- frontend/src/components/Playlists.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Playlists.tsx b/frontend/src/components/Playlists.tsx index 14c84d5..910d9d8 100644 --- a/frontend/src/components/Playlists.tsx +++ b/frontend/src/components/Playlists.tsx @@ -205,9 +205,13 @@ export default function Playlists({ canWrite }: { canWrite: boolean }) { const order = useUndoable([], { onApply: (next) => { if (selectedId == null) return; - api - .reorderPlaylist(selectedId, next.map((v) => v.id)) - .then(() => qc.invalidateQueries({ queryKey: ["playlists"] })); + api.reorderPlaylist(selectedId, next.map((v) => v.id)).then(() => { + // Refresh the sidebar (cover may change) and the detail (so the now-dirty state, + // and the Reset/Unsynced indicators, show without an F5). The membership guard + // keeps the refetch from wiping the undo history on a pure reorder. + qc.invalidateQueries({ queryKey: ["playlists"] }); + qc.invalidateQueries({ queryKey: ["playlist", selectedId] }); + }); }, }); const items = order.value;