From c12181fe167f9b94c157226282c437e1f06176e4 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Wed, 29 Sep 2021 22:28:27 +0200 Subject: [PATCH] fixed srcID on context menu action --- src/components/FileBrowser.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/FileBrowser.tsx b/src/components/FileBrowser.tsx index d89927f..32ec9a5 100644 --- a/src/components/FileBrowser.tsx +++ b/src/components/FileBrowser.tsx @@ -22,9 +22,9 @@ const FileBrowser: React.FC = (props) => { const [openFileId, setOpenFileId] = useState() const [showFile, setShowFile] = useState(false) - const [srcID,setSrcID] = useState(path) + const [srcID,setSrcID] = useState() const [pasteAction,setPasteAction] = useState() - const [editID,setEditID] = useState(path) + const [editID,setEditID] = useState() const [editEnable,setEditEnable] = useState(false) const [deleteMutation] = useDeleteFileMutation() @@ -70,14 +70,15 @@ const FileBrowser: React.FC = (props) => { setPasteAction(action) break case Action.FilePaste: - if (pasteAction === Action.FileCopy){ + if (pasteAction === Action.FileCopy && srcID){ await copyMutation({variables:{src:srcID,dest:path}}) refetchDir() } - if (pasteAction === Action.FileMove){ + if (pasteAction === Action.FileMove && srcID){ await moveMutation({variables:{src:srcID,dest:path}}) refetchDir() + setSrcID(null) } break case Action.DirDelete: