From c95f3b2283f3dc959cf01666e030eb1a46a837d7 Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Tue, 10 Dec 2024 15:13:11 -0800 Subject: [PATCH] Fix unawaited promises in dir preview (#1474) --- frontend/app/view/preview/directorypreview.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/app/view/preview/directorypreview.tsx b/frontend/app/view/preview/directorypreview.tsx index c7c4bd6ba..e0fce8a83 100644 --- a/frontend/app/view/preview/directorypreview.tsx +++ b/frontend/app/view/preview/directorypreview.tsx @@ -293,7 +293,8 @@ function DirectoryTable({ newPath = path.replace(fileName, newName); console.log(`replacing ${fileName} with ${newName}: ${path}`); fireAndForget(async () => { - await FileService.Rename(globalStore.get(model.connection), path, newPath); + const connection = await globalStore.get(model.connection); + await FileService.Rename(connection, path, newPath); model.refreshCallback(); }); } @@ -804,7 +805,8 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) { onSave: (newName: string) => { console.log(`newFile: ${newName}`); fireAndForget(async () => { - await FileService.TouchFile(globalStore.get(model.connection), `${dirPath}/${newName}`); + const connection = await globalStore.get(model.connection); + await FileService.TouchFile(connection, `${dirPath}/${newName}`); model.refreshCallback(); }); setEntryManagerProps(undefined); @@ -817,7 +819,8 @@ function DirectoryPreview({ model }: DirectoryPreviewProps) { onSave: (newName: string) => { console.log(`newDirectory: ${newName}`); fireAndForget(async () => { - await FileService.Mkdir(globalStore.get(model.connection), `${dirPath}/${newName}`); + const connection = await globalStore.get(model.connection); + await FileService.Mkdir(connection, `${dirPath}/${newName}`); model.refreshCallback(); }); setEntryManagerProps(undefined);