diff --git a/src/components/FileBrowser.tsx b/src/components/FileBrowser.tsx index 4d9f18d..b3190d9 100644 --- a/src/components/FileBrowser.tsx +++ b/src/components/FileBrowser.tsx @@ -30,7 +30,7 @@ const FileBrowser: React.FC = () => { id: CONTEXT_MENU_DIR, }) - const { data, loading } = useOpenDirQuery({ + const { data, loading, refetch: refetchDir } = useOpenDirQuery({ variables:{ path } @@ -44,6 +44,7 @@ const FileBrowser: React.FC = () => { } await Promise.all(wait) + refetchDir() } function openFileContextMenu(e: React.MouseEvent, id: string) { @@ -64,10 +65,11 @@ const FileBrowser: React.FC = () => { }) } - function onContextSelect(action:Action, id: string) { + async function onContextSelect(action:Action, id: string) { switch (action) { case Action.FileDelete: - deleteMutation({variables:{id}}) + await deleteMutation({variables:{id}}) + refetchDir() break case Action.FileCopy: case Action.FileMove: @@ -76,11 +78,13 @@ const FileBrowser: React.FC = () => { break case Action.FilePaste: if (pasteAction === Action.FileCopy){ - copyMutation({variables:{src:srcID,dest:path}}) + await copyMutation({variables:{src:srcID,dest:path}}) + refetchDir() } if (pasteAction === Action.FileMove){ - moveMutation({variables:{src:srcID,dest:path}}) + await moveMutation({variables:{src:srcID,dest:path}}) + refetchDir() } break default: diff --git a/src/components/FileBrowserContextMenu.tsx b/src/components/FileBrowserContextMenu.tsx index 974beb3..0ae4ccf 100644 --- a/src/components/FileBrowserContextMenu.tsx +++ b/src/components/FileBrowserContextMenu.tsx @@ -1,5 +1,5 @@ import React from "react" -import { Item, ItemParams, Menu, Separator, Submenu } from "react-contexify" +import { Item, ItemParams, Menu, Separator } from "react-contexify" export const CONTEXT_MENU_FILE = "CONTEXT_MENU_FILE" @@ -31,25 +31,14 @@ const FileBrowserContextMenu: React.FC = (props) => { Delete Copy Move + Paste - - Disabled - - - Sub Item 1 - Sub Item 2 - Item 1 Item 2 - Disabled - - - Sub Item 1 - Sub Item 2 - + Paste )