Skip to content

Commit

Permalink
chore: fix linter warning related to useEffect (#729)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhopperlowe authored Dec 2, 2024
1 parent f6cbd25 commit 7b2a531
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ui/admin/app/components/knowledge/KnowledgeSourceDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import cronstrue from "cronstrue";
import { EditIcon, Eye, InfoIcon, Trash } from "lucide-react";
import { FC, useCallback, useEffect, useMemo, useRef, useState } from "react";
import useSWR, { SWRResponse } from "swr";
import useSWR from "swr";

import {
KnowledgeFile,
Expand Down Expand Up @@ -85,7 +85,7 @@ const KnowledgeSourceDetail: FC<KnowledgeSourceDetailProps> = ({
}
}, [syncSchedule]);

const getFiles: SWRResponse<KnowledgeFile[], Error> = useSWR(
const getFiles = useSWR(
KnowledgeService.getFilesForKnowledgeSource.key(
agentId,
knowledgeSource.id
Expand Down Expand Up @@ -145,6 +145,7 @@ const KnowledgeSourceDetail: FC<KnowledgeSourceDetailProps> = ({
scrollPosition.current = tableContainerRef?.current?.scrollTop ?? 0;
};

const refreshFiles = getFiles.mutate;
useEffect(() => {
if (
knowledgeSource.state === KnowledgeSourceStatus.Syncing ||
Expand All @@ -154,9 +155,9 @@ const KnowledgeSourceDetail: FC<KnowledgeSourceDetailProps> = ({
}

if (knowledgeSource.state === KnowledgeSourceStatus.Synced) {
getFiles.mutate();
refreshFiles();
}
}, [knowledgeSource]);
}, [knowledgeSource, refreshFiles]);

const onSourceUpdate = async (syncSchedule: string) => {
const updatedSource = await KnowledgeService.updateKnowledgeSource(
Expand Down

0 comments on commit 7b2a531

Please sign in to comment.