fix(sf-fe): decode cad in Server Component (B5 400 regression after #356) (#359)
Some checks failed
Deploy / changes (push) Successful in 5s
Deploy / build-backend (push) Has been skipped
Deploy / deploy (push) Blocked by required conditions
Deploy / build-worker (push) Has been skipped
Deploy / build-frontend (push) Has been cancelled

This commit is contained in:
lekss361 2026-05-18 04:07:03 +00:00
parent bf5a55fcd0
commit 1bbd4e835d

View file

@ -9,10 +9,17 @@ interface PageProps {
params: Promise<{ cad: string }>;
}
// Next.js delivers `cad` URL-encoded (":" -> "%3A"); decode once at the page
// boundary so downstream hooks/components see canonical "66:41:0204016:10"
// and re-encode exactly once when building API URLs / hrefs (prevents the
// double-encode that made backend regex reject the cad with HTTP 400).
// Regression history: PR #351 added this in Client Component; A7 split into
// Server Component (PR #356) dropped it; this restores in Server boundary.
export async function generateMetadata({
params,
}: PageProps): Promise<Metadata> {
const { cad } = await params;
const { cad: cadRaw } = await params;
const cad = decodeURIComponent(cadRaw);
return {
title: `Анализ ${cad} — Site Finder`,
description: `Анализ инвестиционного участка ${cad}`,
@ -22,7 +29,8 @@ export async function generateMetadata({
// ── Page ──────────────────────────────────────────────────────────────────────
export default async function AnalysisPage({ params }: PageProps) {
const { cad } = await params;
const { cad: cadRaw } = await params;
const cad = decodeURIComponent(cadRaw);
return (
<Suspense