From 3bebcb6bf0959dc6736f4496c71d4811bfba6fad Mon Sep 17 00:00:00 2001 From: moontwister <16399556+moontwister@users.noreply.github.com> Date: Sun, 27 Sep 2026 07:59:23 +0200 Subject: [PATCH] Refresh library lists after played state changes elsewhere 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. --- src/components/QueryClientEventHandler.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/QueryClientEventHandler.tsx b/src/components/QueryClientEventHandler.tsx index 75cb7dbaf6..d29517888c 100644 --- a/src/components/QueryClientEventHandler.tsx +++ b/src/components/QueryClientEventHandler.tsx @@ -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; };