fix: after logging out and entering the knowledge base page again, the data before still exists #1306 (#1597)

### What problem does this PR solve?

fix: after logging out and entering the knowledge base page again, the
data before still exists #1306
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-07-19 09:07:36 +08:00
committed by GitHub
parent cf4fff64f8
commit fb21efd77d
13 changed files with 175 additions and 138 deletions

View File

@ -1,5 +1,5 @@
import { useTranslate } from '@/hooks/common-hooks';
import { useFetchKnowledgeList } from '@/hooks/knowledge-hooks';
import { useNextFetchKnowledgeList } from '@/hooks/knowledge-hooks';
import { IModalProps } from '@/interfaces/common';
import { filterOptionsByInput } from '@/utils/commonUtil';
import { Form, Modal, Select } from 'antd';
@ -13,7 +13,7 @@ const ConnectToKnowledgeModal = ({
loading,
}: IModalProps<string[]> & { initialValue: string[] }) => {
const [form] = Form.useForm();
const { list, fetchList } = useFetchKnowledgeList();
const { list } = useNextFetchKnowledgeList();
const { t } = useTranslate('fileManager');
const options = list?.map((item) => ({
@ -30,9 +30,8 @@ const ConnectToKnowledgeModal = ({
useEffect(() => {
if (visible) {
form.setFieldValue('knowledgeIds', initialValue);
fetchList();
}
}, [visible, fetchList, initialValue, form]);
}, [visible, initialValue, form]);
return (
<Modal