Skip to content

Commit bdf8784

Browse files
Slashgearclaude
andcommitted
perf: switch past events and static pages to full SSG
- Wrap fetchPastEvents with React cache() to deduplicate API calls during build (generateStaticParams + PastEvents component) - Remove revalidate=3600 from past events pages (content doesn't change) - Remove revalidate=3600 from event detail pages (pre-generated at build) - Remove revalidate=3600 from MDX pages (no external data) - Keep ISR only on homepage (displays upcoming event) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a590026 commit bdf8784

7 files changed

Lines changed: 3 additions & 9 deletions

File tree

app/a-propos/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Content from './content.mdx';
55
export default function APropos() {
66
return <Content />;
77
}
8-
export const revalidate = 3600;
98
const title = 'LyonJS | À propos';
109
const description =
1110
"Qu'est-ce que LyonJS, comment le meetup est organisé ? Comment participer ? Qui sont les organisateurs ?";

app/budget-et-financement/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Content from './content.mdx';
55
export default function BudgetEtFinancement() {
66
return <Content />;
77
}
8-
export const revalidate = 3600;
98
const title = 'LyonJS | Budget et financement de l’association';
109
const description = "Quelles sont les dépenses de l'association LyonJS, comment elle se finance";
1110

app/devenir-sponsor/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export default function BecomeSponsor() {
99
</main>
1010
);
1111
}
12-
export const revalidate = 3600;
1312
const title = 'LyonJS | Devenir sponsor';
1413
const description = 'Vous souhaitez sponsoriser un événement de LyonJS, voici toutes les informations nécessaires';
1514

app/evenement/[slug]/page.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import { fetchPastEvents } from '../../../modules/meetup/queries/past-events.api
88
import { notFound } from 'next/navigation';
99
import { Metadata } from 'next';
1010

11-
export const revalidate = 3600;
12-
1311
export async function generateStaticParams() {
1412
const events = await fetchPastEvents();
1513
return events.map((event) => ({ slug: slugEventTitle(event) }));

app/evenements-precedents/[year]/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import { Metadata } from 'next';
44
import { PastEvents } from './pastEvents';
55
import { fetchPastEvents } from '../../../modules/meetup/queries/past-events.api';
6-
export const revalidate = 3600;
76
const DEFAULT_YEAR = `${new Date().getFullYear()}`;
87

98
export default async function PastEventsPage({ params }: { params: Promise<{ year?: string }> }) {

app/lyonjs-100/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Content from './content.mdx';
55
export default function LyonJS100() {
66
return <Content />;
77
}
8-
export const revalidate = 3600;
98
const title = 'LyonJS | LyonJS 💯';
109
const description =
1110
"Qu'est ce que le LyonJS 100 ? Comment participer à la journée de conférence ? Les replays des conférences";

modules/meetup/queries/past-events.api.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { cache } from 'react';
12
import { Event } from '../../event/types';
23
import { gql } from 'graphql-request';
34
import { client, Edges, LYONJS_MEETUP_ID } from '../api';
@@ -38,9 +39,9 @@ const query = gql`
3839
}
3940
`;
4041

41-
export const fetchPastEvents = async (): Promise<Array<Event>> => {
42+
export const fetchPastEvents = cache(async (): Promise<Array<Event>> => {
4243
const meetupEventsResponse = await client.request<ResponseType>(query, { id: LYONJS_MEETUP_ID });
4344
const pastEvents = meetupEventsResponse?.group?.events?.edges.map((it) => it.node).toReversed() || [];
4445

4546
return pastEvents;
46-
};
47+
});

0 commit comments

Comments
 (0)