From bbebf494bb9050ebce4c8f88a549c5115d501e0b Mon Sep 17 00:00:00 2001 From: ajnart Date: Tue, 7 Jul 2026 18:28:04 +0200 Subject: [PATCH] refactor: pass isFetching as prop to WidgetCacheAge to avoid duplicate useIsFetching --- .../board/items/widget-context-menu.tsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/nextjs/src/components/board/items/widget-context-menu.tsx b/apps/nextjs/src/components/board/items/widget-context-menu.tsx index 14740a250..c3f3469cb 100644 --- a/apps/nextjs/src/components/board/items/widget-context-menu.tsx +++ b/apps/nextjs/src/components/board/items/widget-context-menu.tsx @@ -232,7 +232,7 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont {tMenu("refresh")} - + @@ -270,9 +270,16 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont ); }; -const WidgetCacheAge = ({ queryClient, queryKey }: { queryClient: QueryClient; queryKey: unknown[] }) => { - const isFetching = useIsFetching({ queryKey }) > 0; - // ponytail: 1s tick for "just now" → "1s ago" transition; useIsFetching handles refetch reactivity +const WidgetCacheAge = ({ + queryClient, + queryKey, + isFetching, +}: { + queryClient: QueryClient; + queryKey: unknown[]; + isFetching: boolean; +}) => { + // 1s tick for "just now" → "1s ago" label transition; isFetching prop handles refetch reactivity const [, setTick] = useState(0); useEffect(() => { const id = setInterval(() => setTick((n) => n + 1), 1000);