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: