Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
fix(client): keep NodeSpec / NodeGroups cache forever — Phase 1.2 regression
trohitg3bc2f501cfa3
diff --git a/client/src/lib/nodeSpec.ts b/client/src/lib/nodeSpec.tsindex 6dedbe36..b3382aae 100644--- a/client/src/lib/nodeSpec.ts+++ b/client/src/lib/nodeSpec.ts@@ -18,7 +18,7 @@ import { nodeSpecToDescription, type NodeSpec } from '../adapters/nodeSpecToDescimport type { INodeTypeDescription } from '../types/INodeProperties';import { featureFlags } from './featureFlags';import { queryClient } from './queryClient';-import { STALE_TIME } from './queryConfig';+import { GC_TIME, STALE_TIME } from './queryConfig';import { useWebSocket } from '../contexts/WebSocketContext';type SendRequest = (type: string, data?: any) => Promise<any>;@@ -45,6 +45,12 @@ export async function fetchNodeSpec(}},staleTime: STALE_TIME.FOREVER,+ // useNodeSpec subscribes via useSyncExternalStore (no observer), so+ // without an explicit gcTime override every spec entry is evicted+ // ~5 min after prefetch lands. That makes node icons + handles+ // disappear on every idle canvas. Keep the entries forever; the+ // persistor in lib/queryPersist.ts also writes them to localStorage.+ gcTime: GC_TIME.FOREVER,});}@@ -132,6 +138,7 @@ export function useNodeGroups(): UseQueryResult<Record<string, NodeGroupEntry>>},enabled: isReady,staleTime: STALE_TIME.FOREVER,+ gcTime: GC_TIME.FOREVER,});}@@ -163,6 +170,7 @@ export async function fetchNodeGroups(return (response?.groups ?? {}) as Record<string, NodeGroupEntry>;},staleTime: STALE_TIME.FOREVER,+ gcTime: GC_TIME.FOREVER,});}diff --git a/client/src/lib/queryConfig.ts b/client/src/lib/queryConfig.tsindex e01e59a8..aedd472f 100644--- a/client/src/lib/queryConfig.ts+++ b/client/src/lib/queryConfig.ts@@ -40,6 +40,14 @@ export const STALE_TIME = {export const GC_TIME = {DEFAULT: 5 * 60_000,CATALOGUE: 10 * 60_000,+ /**+ * Never garbage-collect. Use for catalogue / NodeSpec entries that+ * are subscribed via `useSyncExternalStore` (no `useQuery` observer+ * holds them alive) and survive page reloads via the persistor in+ * `lib/queryPersist.ts`. Without this, idle entries vanish from the+ * cache after `DEFAULT` and every consumer reads `undefined`.+ */+ FOREVER: Infinity,} as const;/**