mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
invalidate recentlyPlayed and mostPlayed carousels on scrobble submission
This commit is contained in:
@@ -133,6 +133,7 @@ const HomeRoute = () => {
|
||||
containerQuery={containerQuery}
|
||||
enableRefresh={carousel.enableRefresh}
|
||||
key={`carousel-${carousel.uniqueId}`}
|
||||
queryKey={['home', carousel.uniqueId] as const}
|
||||
rowCount={1}
|
||||
sortBy={carousel.sortBy as AlbumListSort}
|
||||
sortOrder={carousel.sortOrder}
|
||||
@@ -147,6 +148,7 @@ const HomeRoute = () => {
|
||||
containerQuery={containerQuery}
|
||||
enableRefresh={carousel.enableRefresh}
|
||||
key={`carousel-${carousel.uniqueId}`}
|
||||
queryKey={['home', carousel.uniqueId] as const}
|
||||
rowCount={1}
|
||||
sortBy={carousel.sortBy as SongListSort}
|
||||
sortOrder={carousel.sortOrder}
|
||||
|
||||
@@ -20,16 +20,27 @@ export const useSendScrobble = (options?: MutationOptions) => {
|
||||
onSuccess: (_data, variables) => {
|
||||
// Manually increment the play count for the song in the queue if scrobble was submitted
|
||||
if (variables.query.submission) {
|
||||
const serverId = variables.apiClientProps.serverId;
|
||||
incrementQueuePlayCount([variables.query.id]);
|
||||
|
||||
// Invalidate the album detail query for the song's album
|
||||
if (variables.query.albumId && variables.apiClientProps.serverId) {
|
||||
if (variables.query.albumId) {
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: queryKeys.albums.detail(variables.apiClientProps.serverId, {
|
||||
queryKey: queryKeys.albums.detail(serverId, {
|
||||
id: variables.query.albumId,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
// Invalidate recently played carousel on home route
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['home', 'recentlyPlayed'],
|
||||
});
|
||||
|
||||
// Invalidate most played carousel on home route
|
||||
queryClient.invalidateQueries({
|
||||
queryKey: ['home', 'mostPlayed'],
|
||||
});
|
||||
}
|
||||
},
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user