(
agentPubkey: string | null | undefined,
options?: { enabled?: boolean },
)
| 62 | * when no agent is selected) to skip the call entirely. |
| 63 | */ |
| 64 | export function useAgentMemoryQuery( |
| 65 | agentPubkey: string | null | undefined, |
| 66 | options?: { enabled?: boolean }, |
| 67 | ) { |
| 68 | const enabled = (options?.enabled ?? true) && !!agentPubkey; |
| 69 | return useQuery<AgentMemoryListing>({ |
| 70 | enabled, |
| 71 | queryKey: agentMemoryQueryKey(agentPubkey ?? ""), |
| 72 | queryFn: () => getAgentMemory(agentPubkey as string), |
| 73 | staleTime: 30_000, |
| 74 | }); |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Convenience wrapper: feeds the listing through {@link buildMemoryGraph} |
no test coverage detected