fix: update dynamic routes for Next.js 16 async params API
Some checks failed
Deploy Fediversion / deploy (push) Failing after 1s

This commit is contained in:
fullsizemalt 2025-12-29 22:16:11 -08:00
parent e68486ddd2
commit d4f6f60df6
8 changed files with 36 additions and 25 deletions

View file

@ -6,7 +6,7 @@ import { VERTICALS } from "@/config/verticals"
import { notFound } from "next/navigation"
interface Props {
params: { vertical: string }
params: Promise<{ vertical: string }>
}
export function generateStaticParams() {
@ -19,8 +19,9 @@ export function generateStaticParams() {
const currentYear = new Date().getFullYear()
const years = Array.from({ length: 50 }, (_, i) => currentYear - i)
export default function VerticalArchivePage({ params }: Props) {
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
export default async function VerticalArchivePage({ params }: Props) {
const { vertical: verticalSlug } = await params
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
if (!vertical) {
notFound()
@ -32,7 +33,7 @@ export default function VerticalArchivePage({ params }: Props) {
<p className="text-muted-foreground">Browse shows by year.</p>
<div className="grid gap-4 md:grid-cols-3 lg:grid-cols-4">
{years.map((year) => (
<Link key={year} href={`/${params.vertical}/shows?year=${year}`}>
<Link key={year} href={`/${verticalSlug}/shows?year=${year}`}>
<Card className="hover:bg-accent/50 transition-colors cursor-pointer text-center py-6">
<CardContent>
<div className="text-4xl font-bold text-primary">{year}</div>

View file

@ -2,7 +2,7 @@ import { notFound } from "next/navigation"
import { VERTICALS } from "@/config/verticals"
interface Props {
params: { vertical: string }
params: Promise<{ vertical: string }>
}
export function generateStaticParams() {
@ -11,8 +11,9 @@ export function generateStaticParams() {
}))
}
export default function VerticalPage({ params }: Props) {
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
export default async function VerticalPage({ params }: Props) {
const { vertical: verticalSlug } = await params
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
if (!vertical) {
notFound()

View file

@ -3,7 +3,7 @@ import { notFound } from "next/navigation"
import { getApiUrl } from "@/lib/api-config"
interface Props {
params: { vertical: string }
params: Promise<{ vertical: string }>
}
export function generateStaticParams() {
@ -25,7 +25,8 @@ async function getShows(verticalSlug: string) {
}
export default async function ShowsPage({ params }: Props) {
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
const { vertical: verticalSlug } = await params
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
if (!vertical) {
notFound()

View file

@ -3,7 +3,7 @@ import { notFound } from "next/navigation"
import { getApiUrl } from "@/lib/api-config"
interface Props {
params: { vertical: string }
params: Promise<{ vertical: string }>
}
export function generateStaticParams() {
@ -25,7 +25,8 @@ async function getSongs(verticalSlug: string) {
}
export default async function SongsPage({ params }: Props) {
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
const { vertical: verticalSlug } = await params
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
if (!vertical) {
notFound()

View file

@ -3,7 +3,7 @@ import { notFound } from "next/navigation"
import { getApiUrl } from "@/lib/api-config"
interface Props {
params: { vertical: string }
params: Promise<{ vertical: string }>
}
export function generateStaticParams() {
@ -25,7 +25,8 @@ async function getVenues(verticalSlug: string) {
}
export default async function VenuesPage({ params }: Props) {
const vertical = VERTICALS.find((v) => v.slug === params.vertical)
const { vertical: verticalSlug } = await params
const vertical = VERTICALS.find((v) => v.slug === verticalSlug)
if (!vertical) {
notFound()

View file

@ -7,9 +7,9 @@ import { Separator } from "@/components/ui/separator"
import Link from "next/link"
interface ArtistPageProps {
params: {
params: Promise<{
slug: string
}
}>
}
async function getArtist(slug: string) {
@ -26,7 +26,8 @@ async function getArtist(slug: string) {
}
export async function generateMetadata({ params }: ArtistPageProps): Promise<Metadata> {
const data = await getArtist(params.slug)
const { slug } = await params
const data = await getArtist(slug)
if (!data) return { title: "Artist Not Found" }
return {
@ -36,7 +37,8 @@ export async function generateMetadata({ params }: ArtistPageProps): Promise<Met
}
export default async function ArtistPage({ params }: ArtistPageProps) {
const data = await getArtist(params.slug)
const { slug } = await params
const data = await getArtist(slug)
if (!data) return notFound()
const { artist, covers, guest_appearances } = data

View file

@ -8,9 +8,9 @@ import Link from "next/link"
import { Music, Calendar, MapPin, Users, ExternalLink, Globe } from "lucide-react"
interface BandPageProps {
params: {
params: Promise<{
slug: string
}
}>
}
async function getBand(slug: string) {
@ -27,7 +27,8 @@ async function getBand(slug: string) {
}
export async function generateMetadata({ params }: BandPageProps): Promise<Metadata> {
const data = await getBand(params.slug)
const { slug } = await params
const data = await getBand(slug)
if (!data) return { title: "Band Not Found" }
return {
@ -37,7 +38,8 @@ export async function generateMetadata({ params }: BandPageProps): Promise<Metad
}
export default async function BandPage({ params }: BandPageProps) {
const data = await getBand(params.slug)
const { slug } = await params
const data = await getBand(slug)
if (!data) return notFound()
const { band, current_members, past_members, stats } = data

View file

@ -7,9 +7,9 @@ import Link from "next/link"
import { Music, Calendar, MapPin, Users, ExternalLink, Globe, Instagram } from "lucide-react"
interface MusicianPageProps {
params: {
params: Promise<{
slug: string
}
}>
}
async function getMusician(slug: string) {
@ -26,7 +26,8 @@ async function getMusician(slug: string) {
}
export async function generateMetadata({ params }: MusicianPageProps): Promise<Metadata> {
const data = await getMusician(params.slug)
const { slug } = await params
const data = await getMusician(slug)
if (!data) return { title: "Musician Not Found" }
return {
@ -36,7 +37,8 @@ export async function generateMetadata({ params }: MusicianPageProps): Promise<M
}
export default async function MusicianPage({ params }: MusicianPageProps) {
const data = await getMusician(params.slug)
const { slug } = await params
const data = await getMusician(slug)
if (!data) return notFound()
const { musician, bands, guest_appearances, sit_in_summary, stats } = data