Skip to content

Commit eda7137

Browse files
committed
app: wait for loadFile before opening file tab
1 parent cf5cfb4 commit eda7137

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/app/src/pages/session/helpers.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ export const createOpenReviewFile = (input: {
2424
showAllFiles: () => void
2525
tabForPath: (path: string) => string
2626
openTab: (tab: string) => void
27-
loadFile: (path: string) => void
27+
loadFile: (path: string) => any | Promise<void>
2828
}) => {
2929
return (path: string) => {
3030
batch(() => {
3131
input.showAllFiles()
32-
input.openTab(input.tabForPath(path))
33-
input.loadFile(path)
32+
const maybePromise = input.loadFile(path)
33+
const openTab = () => input.openTab(input.tabForPath(path))
34+
if (maybePromise instanceof Promise) maybePromise.then(openTab)
35+
else openTab()
3436
})
3537
}
3638
}

0 commit comments

Comments
 (0)