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:
parent
f6e662ff14
commit
a2ad555ef3
1 changed files with 7 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue