Skip to content

Fully autonomous AI Agents system capable of performing complex penetration testing tasks

fix(frontend): always refetch knowledgeDocuments on provider remount

Sergey Kozyrenko35e077fd8b16
diff --git a/frontend/src/providers/knowledges-provider.tsx b/frontend/src/providers/knowledges-provider.tsx
index b73e3bff..1b02a53d 100644
--- a/frontend/src/providers/knowledges-provider.tsx
+++ b/frontend/src/providers/knowledges-provider.tsx
@@ -46,8 +46,13 @@ export const KnowledgesProvider = ({ children }: KnowledgesProviderProps) => {
const shouldFetch = Boolean(authInfo && authInfo.type !== 'guest' && isAuthenticated());
+ // Override the client's default `nextFetchPolicy: 'cache-first'`: since
+ // subscriptions are scoped to this provider, the cache can drift while the
+ // user is on other pages (AI agents write documents during flow runs).
+ // Re-mounting the provider on return to /knowledges should refresh.
const { data, loading: isLoading } = useKnowledgeDocumentsQuery({
fetchPolicy: 'cache-and-network',
+ nextFetchPolicy: 'cache-and-network',
skip: !shouldFetch,
variables: { withContent: true },
});