-
Notifications
You must be signed in to change notification settings - Fork 0
feat: [performance improvement] #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,19 +20,22 @@ export const revalidate = 3600; | |
|
|
||
| export async function generateStaticParams() { | ||
| const years = getAvailableEditions(); | ||
| const params = []; | ||
|
|
||
| for (const year of years) { | ||
| const companies = await getJobOffersForEdition(year); | ||
| for (const company of companies) { | ||
| params.push({ | ||
| year, | ||
| companyName: company.id, | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| return params; | ||
| const nestedParams = await Promise.all( | ||
| years.map(async (year) => { | ||
| const params: { year: string; companyName: string }[] = []; | ||
| const companies = await getJobOffersForEdition(year); | ||
| for (const company of companies) { | ||
| params.push({ | ||
| year, | ||
| companyName: company.id, | ||
| }); | ||
| } | ||
| return params; | ||
| }) | ||
| ); | ||
|
Comment on lines
+24
to
+36
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Simplify the nested mapping using |
||
|
|
||
| return nestedParams.flat(); | ||
| } | ||
|
|
||
| export async function generateMetadata({ params }: CompanyJobOffersPageProps): Promise<Metadata> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,20 +20,23 @@ interface SpeakerDetailProps { | |
|
|
||
| export async function generateStaticParams() { | ||
| const years = getArchivedEditions(); | ||
| const params = []; | ||
|
|
||
| for (const year of years) { | ||
| try { | ||
| const speakers = await getSpeakers(year); | ||
| for (const speaker of speakers) { | ||
| params.push({ year, speakerId: speaker.id }); | ||
| const nestedParams = await Promise.all( | ||
| years.map(async (year) => { | ||
| const params: { year: string; speakerId: string }[] = []; | ||
| try { | ||
| const speakers = await getSpeakers(year); | ||
| for (const speaker of speakers) { | ||
| params.push({ year, speakerId: speaker.id }); | ||
| } | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch speakers for year ${year}:`, error); | ||
| } | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch speakers for year ${year}:`, error); | ||
| } | ||
| } | ||
| return params; | ||
| }) | ||
| ); | ||
|
Comment on lines
+24
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The We should pass References
|
||
|
|
||
| return params; | ||
| return nestedParams.flat(); | ||
| } | ||
|
|
||
| export async function generateMetadata({ params }: SpeakerDetailProps): Promise<Metadata> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,27 +18,30 @@ export const dynamicParams = false; | |
|
|
||
| export async function generateStaticParams() { | ||
| const years = getArchivedEditions(); | ||
| const params = []; | ||
|
|
||
| for (const year of years) { | ||
| try { | ||
| const sessionGroups = await getTalks(year); | ||
| const allTalks = sessionGroups.flatMap((group) => group.sessions); | ||
| const allTags = new Set<string>(); | ||
|
|
||
| for (const talk of allTalks) { | ||
| getTagsFromTalk(talk).forEach((tag) => allTags.add(tag)); | ||
| } | ||
|
|
||
| for (const tag of allTags) { | ||
| params.push({ year, tag: tag.replaceAll(" ", "-").toLowerCase() }); | ||
| const nestedParams = await Promise.all( | ||
| years.map(async (year) => { | ||
| const params: { year: string; tag: string }[] = []; | ||
| try { | ||
| const sessionGroups = await getTalks(year); | ||
| const allTalks = sessionGroups.flatMap((group) => group.sessions); | ||
| const allTags = new Set<string>(); | ||
|
|
||
| for (const talk of allTalks) { | ||
| getTagsFromTalk(talk).forEach((tag) => allTags.add(tag)); | ||
| } | ||
|
|
||
| for (const tag of allTags) { | ||
| params.push({ year, tag: tag.replaceAll(" ", "-").toLowerCase() }); | ||
| } | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch talks for year ${year}:`, error); | ||
| } | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch talks for year ${year}:`, error); | ||
| } | ||
| } | ||
| return params; | ||
| }) | ||
| ); | ||
|
Comment on lines
+22
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The We should pass References
|
||
|
|
||
| return params; | ||
| return nestedParams.flat(); | ||
| } | ||
|
|
||
| export async function generateMetadata({ params }: Readonly<TagPageProps>): Promise<Metadata> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,21 +29,24 @@ interface TalkDetailProps { | |
|
|
||
| export async function generateStaticParams() { | ||
| const years = getArchivedEditions(); | ||
| const params = []; | ||
|
|
||
| for (const year of years) { | ||
| try { | ||
| const sessionGroups = await getTalks(year); | ||
| const allTalks = sessionGroups.flatMap((group) => group.sessions); | ||
| for (const talk of allTalks) { | ||
| params.push({ year, talkId: talk.id }); | ||
|
|
||
| const nestedParams = await Promise.all( | ||
| years.map(async (year) => { | ||
| const params: { year: string; talkId: string }[] = []; | ||
| try { | ||
| const sessionGroups = await getTalks(year); | ||
| const allTalks = sessionGroups.flatMap((group) => group.sessions); | ||
| for (const talk of allTalks) { | ||
| params.push({ year, talkId: talk.id }); | ||
| } | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch talks for year ${year}:`, error); | ||
| } | ||
| } catch (error) { | ||
| console.warn(`Failed to fetch talks for year ${year}:`, error); | ||
| } | ||
| } | ||
| return params; | ||
| }) | ||
| ); | ||
|
Comment on lines
+33
to
+47
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The We should pass References
|
||
|
|
||
| return params; | ||
| return nestedParams.flat(); | ||
| } | ||
|
|
||
| export async function generateMetadata({ params }: TalkDetailProps): Promise<Metadata> { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recommendation to 'preserve per-item
try/catchfallbacks to prevent a single item failure from crashing the entire batch build' contradicts the repository's general rule. We want data fetching failures during the build process to fail the build so that we do not deploy incomplete pages. Let's update this documentation to reflect the correct practice.References