diff --git a/components/ItemDetail/helpers/TrackOptions.tsx b/components/ItemDetail/helpers/TrackOptions.tsx index 19182732..d9db8a05 100644 --- a/components/ItemDetail/helpers/TrackOptions.tsx +++ b/components/ItemDetail/helpers/TrackOptions.tsx @@ -67,6 +67,10 @@ export default function TrackOptions({ trigger("notificationSuccess"); + queryClient.invalidateQueries({ + queryKey: [QueryKeys.UserPlaylists] + }); + queryClient.invalidateQueries({ queryKey: [QueryKeys.ItemTracks, playlist.Id!], }); diff --git a/enums/query-keys.ts b/enums/query-keys.ts index 8f2d6159..675890b2 100644 --- a/enums/query-keys.ts +++ b/enums/query-keys.ts @@ -27,7 +27,24 @@ export enum QueryKeys { ArtistImage = "ArtistImage", PlaybackStateChange = "PlaybackStateChange", Player = "Player", + + /** + * Query representing the fetching of a user's created playlist. + * + * This differs from "Favorite Playlists", which are playlists + * that exist on the server not created by the user that the user + * has favorited + * + * Invalidation occurs by providing this query key + */ UserPlaylists = "UserPlaylists", + + /** + * Query representing the fetching of tracks for an album or playlist. + * + * Invalidation occurs when the ID of the album or playlist is provided + * as a query key + */ ItemTracks = "ItemTracks", RefreshHome = "RefreshHome", FavoriteArtists = "FavoriteArtists",