Optimize getStaticPaths
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
9e8b381064
commit
3a6f799538
|
@ -121,14 +121,16 @@ export const getStaticProps: GetStaticProps<Props, Params> = async (
|
||||||
|
|
||||||
export const getStaticPaths: GetStaticPaths<Params> = async () => {
|
export const getStaticPaths: GetStaticPaths<Params> = async () => {
|
||||||
const years = await getEventYears();
|
const years = await getEventYears();
|
||||||
const paths = [];
|
const paths = (
|
||||||
for (const year of years) {
|
await Promise.all(
|
||||||
const terms = await getEventTermsByYear(year);
|
years.map(async (year) => {
|
||||||
const yearPaths = terms.map((curTerm) => ({
|
const terms = await getEventTermsByYear(year);
|
||||||
params: { year: year, term: curTerm },
|
return terms.map((curTerm) => ({
|
||||||
}));
|
params: { year: year, term: curTerm },
|
||||||
paths.push(...yearPaths);
|
}));
|
||||||
}
|
})
|
||||||
|
)
|
||||||
|
).flat();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
paths: paths,
|
paths: paths,
|
||||||
|
|
Loading…
Reference in New Issue