From 80baa907abc1b8e897223cf31ed47a9cdfee403e Mon Sep 17 00:00:00 2001 From: Kenan KARAER Date: Wed, 3 Dec 2025 22:57:34 +0300 Subject: [PATCH] Fix: Await params in dynamic routes for Next.js 15 compatibility --- src/app/dashboard/customers/[id]/page.tsx | 5 +++-- src/app/dashboard/reservations/[id]/page.tsx | 2 +- src/app/dashboard/settings/users/[id]/page.tsx | 7 ++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/app/dashboard/customers/[id]/page.tsx b/src/app/dashboard/customers/[id]/page.tsx index 5ea3bcd..864c000 100644 --- a/src/app/dashboard/customers/[id]/page.tsx +++ b/src/app/dashboard/customers/[id]/page.tsx @@ -3,13 +3,14 @@ import { EditCustomerForm } from "./edit-customer-form" import { createClient } from "@/lib/supabase/server" import { notFound } from "next/navigation" -export default async function EditCustomerPage({ params }: { params: { id: string } }) { +export default async function EditCustomerPage({ params }: { params: Promise<{ id: string }> }) { + const { id } = await params const supabase = await createClient() const { data: customer } = await supabase .from('customers') .select('*') - .eq('id', params.id) + .eq('id', id) .single() if (!customer) { diff --git a/src/app/dashboard/reservations/[id]/page.tsx b/src/app/dashboard/reservations/[id]/page.tsx index 066bb47..535347e 100644 --- a/src/app/dashboard/reservations/[id]/page.tsx +++ b/src/app/dashboard/reservations/[id]/page.tsx @@ -16,7 +16,7 @@ export default async function ReservationDetailsPage({ }: { params: Promise<{ id: string }> }) { - const id = (await params).id + const { id } = await params const supabase = await createClient() const { data: reservation } = await supabase diff --git a/src/app/dashboard/settings/users/[id]/page.tsx b/src/app/dashboard/settings/users/[id]/page.tsx index 050b505..6ad68d8 100644 --- a/src/app/dashboard/settings/users/[id]/page.tsx +++ b/src/app/dashboard/settings/users/[id]/page.tsx @@ -4,7 +4,8 @@ import { createClient } from "@/lib/supabase/server" import { createAdminClient } from "@/lib/supabase/admin" import { notFound } from "next/navigation" -export default async function EditUserPage({ params }: { params: { id: string } }) { +export default async function EditUserPage({ params }: { params: Promise<{ id: string }> }) { + const { id } = await params const supabase = await createClient() const supabaseAdmin = await createAdminClient() @@ -12,7 +13,7 @@ export default async function EditUserPage({ params }: { params: { id: string } const { data: profile } = await supabase .from('profiles') .select('*') - .eq('id', params.id) + .eq('id', id) .single() if (!profile) { @@ -22,7 +23,7 @@ export default async function EditUserPage({ params }: { params: { id: string } // Fetch email from auth.users using admin client let email = undefined if (supabaseAdmin) { - const { data: { user }, error } = await supabaseAdmin.auth.admin.getUserById(params.id) + const { data: { user }, error } = await supabaseAdmin.auth.admin.getUserById(id) if (user) { email = user.email }