Skip to content

Commit e60fb2a

Browse files
committed
move parentFileInfo get to click handler
1 parent b964b03 commit e60fb2a

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

frontend/app/view/preview/directorypreview.tsx

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -529,17 +529,6 @@ function TableBody({
529529
}
530530
const normPath = finfo.path;
531531
const fileName = finfo.path.split("/").pop();
532-
let parentFileInfo: FileInfo;
533-
try {
534-
parentFileInfo = await RpcApi.FileInfoCommand(TabRpcClient, {
535-
info: {
536-
path: await model.formatRemoteUri(finfo.dir, globalStore.get),
537-
},
538-
});
539-
} catch (e) {
540-
console.log("could not get parent file info. using child file info as fallback");
541-
parentFileInfo = finfo;
542-
}
543532
const menu: ContextMenuItem[] = [
544533
{
545534
label: "New File",
@@ -620,9 +609,21 @@ function TableBody({
620609
},
621610
{
622611
label: makeNativeLabel(PLATFORM, true, true),
623-
click: () => {
624-
getApi().openNativePath(parentFileInfo.path);
625-
},
612+
click: () =>
613+
fireAndForget(async () => {
614+
let parentFileInfo: FileInfo;
615+
try {
616+
parentFileInfo = await RpcApi.FileInfoCommand(TabRpcClient, {
617+
info: {
618+
path: await model.formatRemoteUri(finfo.dir, globalStore.get),
619+
},
620+
});
621+
} catch (e) {
622+
console.log("could not get parent file info. using child file info as fallback");
623+
parentFileInfo = finfo;
624+
}
625+
getApi().openNativePath(parentFileInfo.path);
626+
}),
626627
}
627628
);
628629
}

0 commit comments

Comments
 (0)