From ad91a3bfa516ea25840fc415dafa3d83c0aa3ab2 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Tue, 14 Jul 2026 00:15:10 +0530 Subject: [PATCH] feat(model-connections): refetch setup status on window focus --- .../atoms/model-connections/model-connections-query.atoms.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts b/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts index f73fc3f18..b6c57af9e 100644 --- a/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts +++ b/surfsense_web/atoms/model-connections/model-connections-query.atoms.ts @@ -54,6 +54,9 @@ export const llmSetupStatusAtomFamily = atomFamily((workspaceId: number) => queryKey: cacheKeys.modelConnections.setupStatus(workspaceId), enabled: workspaceId > 0 && isAuthenticated(), staleTime: 5 * 60 * 1000, + // Recovery is event-driven: mutations invalidate this key; external fixes + // are caught on window focus. No polling, so not-ready tabs cost nothing. + refetchOnWindowFocus: true, queryFn: () => modelConnectionsApiService.getLlmSetupStatus(workspaceId), })) );