Use reduce to handle doc items sequentially

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Josh-Cena 2021-06-21 09:37:35 +08:00
parent 1e8b06d0a4
commit c7525d463b
No known key found for this signature in database
GPG key ID: C37145B818BDB68F

View file

@ -268,10 +268,10 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async functio
} }
// async process made sequential on purpose! order matters // async process made sequential on purpose! order matters
for (const doc of docs) { await docs.reduce(
// eslint-disable-next-line no-await-in-loop (p, doc) => p.then(() => handleDocItem(doc)),
await handleDocItem(doc); Promise.resolve(),
} );
return sidebarItems; return sidebarItems;
} }