diff --git a/src/component/Uploader/Uploader.tsx b/src/component/Uploader/Uploader.tsx
index 4472815..7059e68 100644
--- a/src/component/Uploader/Uploader.tsx
+++ b/src/component/Uploader/Uploader.tsx
@@ -1,6 +1,6 @@
import dayjs from "dayjs";
import { useSnackbar } from "notistack";
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { closeUploadTaskList, openUploadTaskList, setUploadProgress } from "../../redux/globalStateSlice.ts";
import { useAppDispatch, useAppSelector } from "../../redux/hooks.ts";
@@ -12,6 +12,7 @@ import Base, { Status } from "./core/uploader/base.ts";
import { DropFileBackground } from "./DropFile.tsx";
import PasteUploadDialog from "./PasteUploadDialog.tsx";
import TaskList from "./Popup/TaskList.tsx";
+import { defaultTrashPath } from "../../hooks/useNavigation.tsx";
let totalProgressCollector: NodeJS.Timeout | null = null;
let lastProgressStart = -1;
@@ -25,6 +26,8 @@ const Uploader = () => {
const { enqueueSnackbar } = useSnackbar();
const [uploaders, setUploaders] = useState([]);
const [dropBgOpen, setDropBgOpen] = useState(false);
+
+ const pathRef = useRef();
const totalProgress = useAppSelector((state) => state.globalState.uploadProgress);
const taskListOpen = useAppSelector((state) => state.globalState.uploadTaskListOpen);
@@ -34,6 +37,9 @@ const Uploader = () => {
const selectFileSignal = useAppSelector((state) => state.globalState.uploadFileSignal);
const selectFolderSignal = useAppSelector((state) => state.globalState.uploadFolderSignal);
+ // Update path
+ pathRef.current = path;
+
const taskAdded = useCallback(
(original?: Base) => (tasks: Base[]) => {
if (original !== undefined) {
@@ -69,10 +75,16 @@ const Uploader = () => {
enqueueSnackbar(msg, { variant: type });
},
onDropOver: (_e) => {
+ if (pathRef.current === defaultTrashPath) {
+ return;
+ }
dragCounter++;
setDropBgOpen((value) => !value);
},
onDropLeave: (_e) => {
+ if (pathRef.current === defaultTrashPath) {
+ return;
+ }
dragCounter--;
setDropBgOpen((value) => !value);
},
@@ -84,11 +96,11 @@ const Uploader = () => {
}, 1000);
},
});
- }, []);
+ }, [enqueueSnackbar, taskAdded, dispatch]);
useEffect(() => {
uploadManager.setPolicy(policy, path);
- }, [policy]);
+ }, [policy, path]);
const handleUploaderError = useCallback(
(e: any) => {