fix(playlists): refresh playlist detail after add/remove from the feed popover

Adding a video to a playlist via the AddToPlaylist popover invalidated the membership
and the playlist list, but not the playlist *detail* query, so the Playlists page
served stale cached items (the new video only appeared after F5). Invalidate the
["playlist"] detail queries too.
This commit is contained in:
npeter83 2026-06-15 15:20:28 +02:00
parent a6a0c429d5
commit ef11c6c605

View file

@ -86,6 +86,9 @@ export default function AddToPlaylist({
function refresh() { function refresh() {
qc.invalidateQueries({ queryKey: ["playlist-membership", videoId] }); qc.invalidateQueries({ queryKey: ["playlist-membership", videoId] });
qc.invalidateQueries({ queryKey: ["playlists"] }); qc.invalidateQueries({ queryKey: ["playlists"] });
// Also invalidate every open/cached playlist detail (["playlist", id]) so the
// Playlists page reflects the add/remove when navigated to, not only after F5.
qc.invalidateQueries({ queryKey: ["playlist"] });
} }
async function toggle(pl: Playlist) { async function toggle(pl: Playlist) {