allow requests in getStaticProps to execute in parallel

This commit is contained in:
Tobias Koppers
2021-06-14 19:41:18 +02:00
parent d23da23dc0
commit f8fca2dd4d
9 changed files with 43 additions and 25 deletions

View File

@@ -35,9 +35,9 @@ export default function getSiteInfoOperation({
} = {}): Promise<T['data']> {
const cfg = commerce.getConfig(config)
const categories = await getCategories(cfg)
const brands = await getBrands(cfg)
/*
const categoriesPromise = getCategories(cfg)
const brandsPromise = getBrands(cfg)
/*
const { fetch, locale } = cfg
const { data } = await fetch<GetSiteInfoQuery, GetSiteInfoQueryVariables>(
query,
@@ -53,8 +53,8 @@ export default function getSiteInfoOperation({
*/
return {
categories,
brands,
categories: await categoriesPromise,
brands: await brandsPromise,
}
}