From 211db5a62029a14a43969322b9121dc68601034c Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 1 Feb 2026 22:19:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BD=BF=E7=94=A8useParams=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E5=AE=A2=E6=88=B7=E7=AB=AF=E5=AF=BC=E8=88=AA=E6=97=B6?= =?UTF-8?q?id=E6=AD=A3=E7=A1=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/canvas/[id]/page.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/canvas/[id]/page.tsx b/app/canvas/[id]/page.tsx index 081ad5e..134d68a 100644 --- a/app/canvas/[id]/page.tsx +++ b/app/canvas/[id]/page.tsx @@ -1,7 +1,7 @@ "use client"; import { useEffect, useState, useCallback, use } from "react"; -import { useRouter } from "next/navigation"; +import { useRouter, useParams } from "next/navigation"; import { ArrowLeft, Save, @@ -83,7 +83,9 @@ const SIZE_PRESETS = [ ]; export default function CanvasEditorPage({ params }: PageProps) { - const { id } = use(params); + // 使用 useParams 确保客户端导航时能正确获取更新的 id + const routeParams = useParams(); + const id = (routeParams?.id as string) || use(params).id; const router = useRouter(); // Store state