diff --git a/js/src/contents_utils.ts b/js/src/contents_utils.ts index edf2a9f..cc63e7a 100644 --- a/js/src/contents_utils.ts +++ b/js/src/contents_utils.ts @@ -51,11 +51,13 @@ async function* walkPath(path: string[], root: Content */ export async function revealPath(contents: ContentsModel, path: string[]): Promise> { let node: Content; + const promises: Array> = []; for await (node of walkPath(path, contents.root)) { if (!node.isExpand && node.hasChildren) { - await node.expand(); + promises.push(node.expand()); } } + await Promise.all(promises); return node!; } @@ -84,11 +86,13 @@ export async function revealAndSelectPath(contents: Conte * @param path Array of directory names to be opened in order */ export async function openDirRecursive(model: ContentsModel, path: string[]) { + const promises: Array> = []; for await (const node of walkPath(path, model.root)) { if (node.pathstr !== model.root.pathstr) { - await model.openDir(node.row); + promises.push(model.openDir(node.row)); } } + await Promise.all(promises); }