Skip to content

Commit fd7395a

Browse files
authored
fix: use async way of fetching params (#504)
1 parent f5c4528 commit fd7395a

4 files changed

Lines changed: 12 additions & 28 deletions

File tree

app/evenement/[slug]/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import { Metadata } from 'next';
99

1010
export const revalidate = 3600;
1111

12-
export default async function EventPage({ params: { slug } }: { params: { slug: string } }) {
12+
export default async function EventPage({ params }: { params: Promise<{ slug: string }> }) {
13+
const { slug } = await params;
1314
const eventId = parserEventIdFromSlug(slug);
1415
if (!eventId) {
1516
notFound();
@@ -28,7 +29,8 @@ export default async function EventPage({ params: { slug } }: { params: { slug:
2829
}
2930
}
3031

31-
export async function generateMetadata({ params: { slug } }: { params: { slug: string } }): Promise<Metadata> {
32+
export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
33+
const { slug } = await params;
3234
const eventId = parserEventIdFromSlug(slug);
3335
if (!eventId) {
3436
return {};

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

Lines changed: 0 additions & 18 deletions
This file was deleted.

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
import { H1 } from '../../../modules/atoms/remark/Titles';
2-
import React, { Suspense } from 'react';
2+
import React from 'react';
33
import { Metadata } from 'next';
44
import { PastEvents } from './pastEvents';
5-
import { Loader } from './loader';
65

76
export const revalidate = 3600;
7+
const DEFAULT_YEAR = `${new Date().getFullYear()}`;
8+
9+
export default async function PastEventsPage({ params }: { params: Promise<{ year?: string }> }) {
10+
const { year = DEFAULT_YEAR } = await params;
811

9-
export default async function PastEventsPage({ params: { year } }: { params: { year: string } }) {
1012
return (
1113
<main>
1214
<H1>Évènements précédents</H1>
13-
<Suspense fallback={<Loader />}>
14-
<PastEvents year={year}></PastEvents>
15-
</Suspense>
15+
<PastEvents year={year}></PastEvents>
1616
</main>
1717
);
1818
}
1919

20-
export async function generateMetadata({ params: { year } }: { params: { year: string } }): Promise<Metadata> {
20+
export async function generateMetadata({ params }: { params: Promise<{ year?: string }> }): Promise<Metadata> {
21+
const { year = DEFAULT_YEAR } = await params;
2122
const title = `LyonJS | Évènements ${year}`;
2223
const description = `Liste des évènements LyonJS de l'année ${year}, meetup, apéros, conférences et rassemblement, retrouver tous les liens depuis notre création.`;
2324

modules/event/components/EventDetail.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
'use client';
21
import Image from 'next/image';
32
import { H1 } from '../../atoms/remark/Titles';
43
import type { Event } from '../types';

0 commit comments

Comments
 (0)