app: wait for loadFile before opening file tab
This commit is contained in:
@@ -24,13 +24,15 @@ export const createOpenReviewFile = (input: {
|
|||||||
showAllFiles: () => void
|
showAllFiles: () => void
|
||||||
tabForPath: (path: string) => string
|
tabForPath: (path: string) => string
|
||||||
openTab: (tab: string) => void
|
openTab: (tab: string) => void
|
||||||
loadFile: (path: string) => void
|
loadFile: (path: string) => any | Promise<void>
|
||||||
}) => {
|
}) => {
|
||||||
return (path: string) => {
|
return (path: string) => {
|
||||||
batch(() => {
|
batch(() => {
|
||||||
input.showAllFiles()
|
input.showAllFiles()
|
||||||
input.openTab(input.tabForPath(path))
|
const maybePromise = input.loadFile(path)
|
||||||
input.loadFile(path)
|
const openTab = () => input.openTab(input.tabForPath(path))
|
||||||
|
if (maybePromise instanceof Promise) maybePromise.then(openTab)
|
||||||
|
else openTab()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user