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:
parent
52d8ce14e7
commit
5400de3418
1 changed files with 3 additions and 0 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue