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:
Bill Thornton authored and GitHub committed 2026-10-21 09:53:02 -04:00
commit eab1f285b7
1 file changed
+6 -1
+6 -1
View File
@@ -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;
};