From c7525d463b7f8d09b608aa8e978fd7622fd82d24 Mon Sep 17 00:00:00 2001 From: Josh-Cena Date: Mon, 21 Jun 2021 09:37:35 +0800 Subject: [PATCH] Use reduce to handle doc items sequentially Signed-off-by: Josh-Cena --- .../src/sidebarItemsGenerator.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/docusaurus-plugin-content-docs/src/sidebarItemsGenerator.ts b/packages/docusaurus-plugin-content-docs/src/sidebarItemsGenerator.ts index da80765cde..b4f94bc7e4 100644 --- a/packages/docusaurus-plugin-content-docs/src/sidebarItemsGenerator.ts +++ b/packages/docusaurus-plugin-content-docs/src/sidebarItemsGenerator.ts @@ -268,10 +268,10 @@ export const DefaultSidebarItemsGenerator: SidebarItemsGenerator = async functio } // async process made sequential on purpose! order matters - for (const doc of docs) { - // eslint-disable-next-line no-await-in-loop - await handleDocItem(doc); - } + await docs.reduce( + (p, doc) => p.then(() => handleDocItem(doc)), + Promise.resolve(), + ); return sidebarItems; }