From d8aa6b56ecdd35457d5cca89edc7103779b45daf Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 1 Jun 2021 09:28:36 +0200 Subject: [PATCH] parallel requests --- pages/index.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index 3a466c606..93d452645 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -13,15 +13,19 @@ export async function getStaticProps({ locale, }: GetStaticPropsContext) { const config = getConfig({ locale }) - const { pages } = await getAllPages({ config, preview }) - const { categories } = await getSiteInfo({ config, preview }) + const pagesPromise = getAllPages({ config, preview }) + const siteInfoPromise = getSiteInfo({ config, preview }) - const { products } = await getAllProducts({ + const productsPromise = getAllProducts({ variables: { first: 12 }, config, preview, }) + const { pages } = await pagesPromise + const { categories } = await siteInfoPromise + const { products } = await productsPromise + return { props: { products,