From 3de22a31667745e48e4ee3b97086f8b1573b1923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Mon, 27 Jul 2026 15:47:46 +0000 Subject: [PATCH] rescan: refetch inactive item lists too (works from any page) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit invalidateQueries only refetches mounted queries, so a rescan pressed anywhere but the Tasks/Skills/… page just marked those lists stale — the new item wasn't picked up until you opened that page. Pass refetchType: 'all' so every item cache refreshes immediately, wherever the button is pressed. Co-Authored-By: Claude Opus 4.8 --- .../Screens/Dashboard/Layout/Rescan/RescanButton.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/apps/officer-web/Screens/Dashboard/Layout/Rescan/RescanButton.tsx b/src/apps/officer-web/Screens/Dashboard/Layout/Rescan/RescanButton.tsx index ff4e79eb..2e68a621 100644 --- a/src/apps/officer-web/Screens/Dashboard/Layout/Rescan/RescanButton.tsx +++ b/src/apps/officer-web/Screens/Dashboard/Layout/Rescan/RescanButton.tsx @@ -20,7 +20,10 @@ export function RescanButton() { setLoading(true); try { const res = await client.post('/rescan', {}); - await Promise.all(ITEM_QUERY_KEYS.map((key) => qc.invalidateQueries({ queryKey: [key] }))); + // refetchType: 'all' so INACTIVE (unmounted) item lists refetch too — otherwise a rescan from + // anywhere but the Tasks/Skills/… page only marks them stale, and the change isn't picked up until + // you next open that page. This refreshes every item cache immediately, wherever you press it. + await Promise.all(ITEM_QUERY_KEYS.map((key) => qc.invalidateQueries({ queryKey: [key], refetchType: 'all' }))); const c = res.counts ?? {}; toast.success(`Rescanned items — ${c.tasks ?? 0} tasks, ${c.tools ?? 0} tools, ${c.skills ?? 0} skills, ${c.processes ?? 0} processes`); } catch {