Fix unawaited promises in dir preview (#1474)

This commit is contained in:
Evan Simkowitz 2024-12-10 15:13:11 -08:00 committed by GitHub
parent e49480e628
commit c95f3b2283
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);