From ea0f1c75467f9b202e5f96548195f0162d6af57c Mon Sep 17 00:00:00 2001 From: Badbird5907 <50347938+Badbird5907@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:14:37 -0400 Subject: [PATCH] refactor: parallelize version fetching in javadocs page --- src/pages/javadocs.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/javadocs.tsx b/src/pages/javadocs.tsx index 66a1d791..67a7da29 100644 --- a/src/pages/javadocs.tsx +++ b/src/pages/javadocs.tsx @@ -77,10 +77,14 @@ const Javadocs: NextPage = ({ export default Javadocs; export const getStaticProps: GetStaticProps = async () => { - const { version_groups: paper_groups } = await getProject("paper"); - const { version_groups: folia_groups } = await getProject("folia"); - const { version_groups: velocity_groups } = await getProject("velocity"); - const { version_groups: waterfall_groups } = await getProject("waterfall"); + const [paper_groups, folia_groups, velocity_groups, waterfall_groups] = + await Promise.all([ + getProject("paper").then(({ version_groups }) => version_groups), + getProject("folia").then(({ version_groups }) => version_groups), + getProject("velocity").then(({ version_groups }) => version_groups), + getProject("waterfall").then(({ version_groups }) => version_groups), + ]); + return { props: { paperVersion: paper_groups[paper_groups.length - 1],