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.
This commit is contained in:
npeter83 2026-06-15 22:44:57 +02:00
parent 4ec1a0488c
commit a1d7c408ec

View file

@ -205,9 +205,13 @@ export default function Playlists({ canWrite }: { canWrite: boolean }) {
const order = useUndoable<Video[]>([], {
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;