mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-04 03:25:30 +08:00
### What problem does this PR solve? Feat: Bind data to the agent module of the home page #3221 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@ -1,8 +1,11 @@
|
||||
import { useSetModalState } from '@/hooks/common-hooks';
|
||||
import { UseRowSelectionType } from '@/hooks/logic-hooks/use-row-selection';
|
||||
import { useMoveFile } from '@/hooks/use-file-request';
|
||||
import { useCallback, useState } from 'react';
|
||||
import { useCallback, useRef, useState } from 'react';
|
||||
|
||||
export const useHandleMoveFile = () => {
|
||||
export const useHandleMoveFile = ({
|
||||
clearRowSelection,
|
||||
}: Pick<UseRowSelectionType, 'clearRowSelection'>) => {
|
||||
const {
|
||||
visible: moveFileVisible,
|
||||
hideModal: hideMoveFileModal,
|
||||
@ -10,6 +13,7 @@ export const useHandleMoveFile = () => {
|
||||
} = useSetModalState();
|
||||
const { moveFile, loading } = useMoveFile();
|
||||
const [sourceFileIds, setSourceFileIds] = useState<string[]>([]);
|
||||
const isBulkRef = useRef(false);
|
||||
|
||||
const onMoveFileOk = useCallback(
|
||||
async (targetFolderId: string) => {
|
||||
@ -19,16 +23,19 @@ export const useHandleMoveFile = () => {
|
||||
});
|
||||
|
||||
if (ret === 0) {
|
||||
// setSelectedRowKeys([]);
|
||||
if (isBulkRef.current) {
|
||||
clearRowSelection();
|
||||
}
|
||||
hideMoveFileModal();
|
||||
}
|
||||
return ret;
|
||||
},
|
||||
[moveFile, hideMoveFileModal, sourceFileIds],
|
||||
[moveFile, sourceFileIds, hideMoveFileModal, clearRowSelection],
|
||||
);
|
||||
|
||||
const handleShowMoveFileModal = useCallback(
|
||||
(ids: string[]) => {
|
||||
(ids: string[], isBulk = false) => {
|
||||
isBulkRef.current = isBulk;
|
||||
setSourceFileIds(ids);
|
||||
showMoveFileModal();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user