fix(website): update all route/layout params to Promise for Next.js 16
Next.js 15+ requires params to be typed as Promise<{...}> and awaited.
Fixed 17 files: all [locale] pages, layouts, and blog [slug] page.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,9 +10,9 @@ const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL ?? "https://meezi.ir";
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: {
|
||||
params: { locale: string };
|
||||
params: Promise<{ locale: string }>;
|
||||
}): Promise<Metadata> {
|
||||
const { locale } = await Promise.resolve(params);
|
||||
const { locale } = await params;
|
||||
const t = await getTranslations({ locale, namespace: "meta" });
|
||||
|
||||
const ogLocale = locale === "fa" ? "fa_IR" : "en_US";
|
||||
@@ -93,9 +93,9 @@ export default async function LocaleLayout({
|
||||
params,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
params: { locale: string };
|
||||
params: Promise<{ locale: string }>;
|
||||
}) {
|
||||
const { locale } = await Promise.resolve(params);
|
||||
const { locale } = await params;
|
||||
if (!routing.locales.includes(locale as "fa" | "en")) notFound();
|
||||
const messages = await getMessages();
|
||||
const dir = locale === "fa" ? "rtl" : "ltr";
|
||||
|
||||
Reference in New Issue
Block a user