Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: fix fe code to not make requests when validating cache #720

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/admin/app/components/knowledge/AgentKnowledgePanel.tsx
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@ export default function AgentKnowledgePanel({
),
{
revalidateOnFocus: false,
refreshInterval: blockPollingLocalFiles ? undefined : 1000,
refreshInterval: blockPollingLocalFiles ? undefined : 5000,
}
);
const localFiles = useMemo(
@@ -110,7 +110,7 @@ export default function AgentKnowledgePanel({
({ agentId }) => KnowledgeService.getKnowledgeSourcesForAgent(agentId),
{
revalidateOnFocus: false,
refreshInterval: blockPollingSources ? undefined : 1000,
refreshInterval: blockPollingSources ? undefined : 5000,
}
);
const knowledgeSources = useMemo(
14 changes: 8 additions & 6 deletions ui/admin/app/components/knowledge/KnowledgeSourceDetail.tsx
Original file line number Diff line number Diff line change
@@ -97,7 +97,7 @@
),
{
revalidateOnFocus: false,
refreshInterval: blockPollingFiles ? undefined : 1000,
refreshInterval: blockPollingFiles ? undefined : 5000,
}
);

@@ -156,7 +156,7 @@
if (knowledgeSource.state === KnowledgeSourceStatus.Synced) {
getFiles.mutate();
}
}, [knowledgeSource, getFiles]);
}, [knowledgeSource]);

Check warning on line 159 in ui/admin/app/components/knowledge/KnowledgeSourceDetail.tsx

GitHub Actions / lint

React Hook useEffect has a missing dependency: 'getFiles'. Either include it or remove the dependency array

const onSourceUpdate = async (syncSchedule: string) => {
const updatedSource = await KnowledgeService.updateKnowledgeSource(
@@ -176,8 +176,9 @@
file.id,
approved
);
getFiles.mutate((files) =>
files?.map((f) => (f.id === file.id ? updatedFile : f))
getFiles.mutate(
(files) => files?.map((f) => (f.id === file.id ? updatedFile : f)),
false
);
};

@@ -203,8 +204,9 @@
file.id,
knowledgeSource.id
);
getFiles.mutate((files) =>
files?.map((f) => (f.id === file.id ? updatedFile : f))
getFiles.mutate(
(files) => files?.map((f) => (f.id === file.id ? updatedFile : f)),
false
);
};