Skip to content

Commit f8c0a88

Browse files
committed
fix partial data page rendering failure
1 parent dd8a025 commit f8c0a88

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

src/app/conf/2023/sessions/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Metadata } from "next"
22
import { SessionList } from "@/app/conf/_components/schedule/session-list"
33
import { schedule, speakers } from "@/app/conf/2023/_data"
4+
import { eventsColors } from '../utils'
5+
import { filterCategories2023 } from '../../_components/schedule/filter-categories'
46

57
export const metadata: Metadata = {
68
title: "Sessions",
@@ -11,6 +13,9 @@ export default function SessionsPage() {
1113
<div className="bg-[#f4f6f8]">
1214
<div className="container conf-block">
1315
<SessionList
16+
year='2023'
17+
eventsColors={eventsColors}
18+
filterCategories={filterCategories2023}
1419
// @ts-expect-error -- fixme
1520
scheduleData={schedule
1621
.filter(schedule => schedule.speakers)

src/app/conf/2023/speakers/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { speakers, schedule } from "@/app/conf/2023/_data"
1212
import { ChevronLeftIcon } from "@/icons"
1313
import NextLink from "next/link"
1414
import { eventsColors } from "../../utils"
15+
import { filterCategories2023 } from '@/app/conf/_components/schedule/filter-categories'
1516

1617
type SpeakerProps = { params: { id: string } }
1718

@@ -47,7 +48,7 @@ export default function SpeakerPage({ params }: SpeakerProps) {
4748
.map(s => ({
4849
...s,
4950
speakers: s.speakers!.map(s =>
50-
speakers.find(speaker => speaker.username === s.username),
51+
speakers.find(speaker => speaker.username === s.username)!,
5152
),
5253
}))
5354

@@ -105,8 +106,8 @@ export default function SpeakerPage({ params }: SpeakerProps) {
105106
/>
106107
</div>
107108
<h1 className="conf-heading mb-10">Sessions</h1>
108-
{/* @ts-expect-error */}
109109
<SessionList
110+
filterCategories={filterCategories2023}
110111
eventsColors={eventsColors}
111112
year="2023"
112113
showFilter={false}

src/app/conf/2024/schedule/[id]/page.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { notFound } from "next/navigation"
22
import { Metadata } from "next"
3-
import { findBestMatch } from "string-similarity"
43
import clsx from "clsx"
54
import { Avatar } from "../../../_components/speakers/avatar"
65
import { BackLink } from "../../../_components/schedule/back-link"
@@ -37,12 +36,11 @@ type SessionProps = { params: { id: string } }
3736
export function generateMetadata({ params }: SessionProps): Metadata {
3837
const event = schedule.find(s => s.id === params.id)!
3938

40-
console.log("EVENTTT", event)
4139
const keywords = [
4240
event.event_type,
4341
event.audience,
4442
event.event_subtype,
45-
...event.speakers!.map(s => s.name),
43+
...(event.speakers || []).map(s => s.name),
4644
].filter(Boolean)
4745

4846
return {
@@ -56,7 +54,7 @@ export function generateMetadata({ params }: SessionProps): Metadata {
5654
}
5755

5856
export function generateStaticParams() {
59-
return schedule.filter(s => s.speakers).map(s => ({ id: s.id }))
57+
return schedule.filter(s => s.id).map(s => ({ id: s.id }))
6058
}
6159

6260
const Tag = ({
@@ -83,7 +81,7 @@ export default function SessionPage({ params }: SessionProps) {
8381
notFound()
8482
}
8583
// @ts-expect-error -- fixme
86-
event.speakers = event.speakers!.map(speaker =>
84+
event.speakers = (event.speakers || []).map(speaker =>
8785
speakers.find(s => s.username === speaker.username),
8886
)
8987

src/app/conf/2024/speakers/[id]/page.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ import { filterCategories2024 } from '@/app/conf/_components/schedule/filter-cat
1717
type SpeakerProps = { params: { id: string } }
1818

1919
export function generateMetadata({ params }: SpeakerProps): Metadata {
20-
const speaker = speakers.find(s => s.username === params.id)!
20+
const decodedId = decodeURIComponent(params.id);
21+
const speaker = speakers.find(s => s.username === decodedId)!
2122

2223
const keywords = [speaker.name, speaker.company, speaker.position].filter(
2324
Boolean,
@@ -34,17 +35,15 @@ export function generateMetadata({ params }: SpeakerProps): Metadata {
3435
}
3536

3637
export function generateStaticParams() {
37-
return speakers.map(s => ({ id: s.username }))
38+
return speakers.map(s => ({ id: s.username }));
3839
}
3940

4041
export default function SpeakerPage({ params }: SpeakerProps) {
41-
const speaker = speakers.find(s => s.username === params.id)
42-
if (!speaker) {
43-
notFound()
44-
}
42+
const decodedId = decodeURIComponent(params.id);
43+
const speaker = speakers.find(s => s.username === decodedId)!
4544

4645
const s = schedule
47-
.filter(s => s.speakers && s.speakers.some(s => s.username === params.id))
46+
.filter(s => s.speakers && s.speakers.some(s => s.username === decodedId))
4847
.map(s => ({
4948
...s,
5049
speakers: s.speakers!.map(s =>

src/app/conf/_components/thanks.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { SessionList } from "./schedule/session-list"
33
import { Button } from "./button"
44
import leeImage from "../2023/gallery/images/3.jpg"
55
import { schedule, speakers } from "@/app/conf/2023/_data"
6+
import { eventsColors } from '../2023/utils'
7+
import { filterCategories2023 } from './schedule/filter-categories'
68

79
function shuffle<T extends any[]>(array: T): T {
810
let currentIndex = array.length
@@ -53,6 +55,9 @@ export async function Thanks() {
5355
</div>
5456
</div>
5557
<SessionList
58+
year='2023'
59+
filterCategories={filterCategories2023}
60+
eventsColors={eventsColors}
5661
showFilter={false}
5762
// @ts-expect-error -- fixme
5863
scheduleData={shuffle(filteredSessions)

0 commit comments

Comments
 (0)