mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2026-10-26 16:45:18 +00:00
Refresh library lists after played state changes elsewhere (#8558)
The library list is cached and only invalidated on UserDataChanged by the items container while it's mounted, so a count changed on the series page stayed stale when going back. Invalidate the item queries from QueryClientEventHandler, which lives for the whole app.
This commit is contained in:
1 file changed
+6
-1
@@ -1,3 +1,4 @@
|
||||
import { OutboundWebSocketMessageType } from '@jellyfin/sdk/lib/websocket';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useCallback, useEffect, type FC } from 'react';
|
||||
|
||||
@@ -8,7 +9,7 @@ import Events from 'utils/events';
|
||||
/** Component that handles mapping events to query client actions. */
|
||||
const QueryClientEventHandler: FC = () => {
|
||||
const queryClient = useQueryClient();
|
||||
const { user } = useApi();
|
||||
const { api, user } = useApi();
|
||||
|
||||
const clearQueries = useCallback(() => (
|
||||
queryClient.clear()
|
||||
@@ -36,6 +37,10 @@ const QueryClientEventHandler: FC = () => {
|
||||
};
|
||||
}, [invalidateItemQueries]);
|
||||
|
||||
useEffect(() => (
|
||||
api?.subscribe([OutboundWebSocketMessageType.UserDataChanged], invalidateItemQueries)
|
||||
), [api, invalidateItemQueries]);
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user