From 99534b5d6ffbe6c9b8622824333bd82d2d390338 Mon Sep 17 00:00:00 2001 From: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co> Date: Fri, 3 Jul 2026 14:04:26 -0700 Subject: [PATCH] fix(desktop): refresh the agent-template catalog on inbound relay sync The agent-templates query pins staleTime: Infinity, so a saved template created, edited, or tombstoned on another device never reached the New Agent catalog until app restart. Invalidate agentTemplatesQueryKey in the agents-data-changed listener alongside the other relay-backed queries. Co-authored-by: Taylor Ho Signed-off-by: Taylor Ho --- desktop/src/features/agents/lib/useAgentsDataRefresh.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/desktop/src/features/agents/lib/useAgentsDataRefresh.ts b/desktop/src/features/agents/lib/useAgentsDataRefresh.ts index 83aa99547..f25b7ba23 100644 --- a/desktop/src/features/agents/lib/useAgentsDataRefresh.ts +++ b/desktop/src/features/agents/lib/useAgentsDataRefresh.ts @@ -3,6 +3,7 @@ import { useQueryClient } from "@tanstack/react-query"; import { useEffect } from "react"; import { + agentTemplatesQueryKey, managedAgentsQueryKey, personasQueryKey, relayAgentsQueryKey, @@ -34,6 +35,13 @@ export function useAgentsDataRefresh(): void { void queryClient.invalidateQueries({ queryKey: teamsQueryKey }); void queryClient.invalidateQueries({ queryKey: managedAgentsQueryKey }); void queryClient.invalidateQueries({ queryKey: relayAgentsQueryKey }); + // Saved templates are persona records, so an inbound persona + // upsert/tombstone from another device changes the New Agent + // catalog too. Without this line the catalog query (staleTime: + // Infinity) would serve the pre-sync list forever. + void queryClient.invalidateQueries({ + queryKey: agentTemplatesQueryKey, + }); }, COALESCE_MS); });