diff --git a/app/canvas/[id]/page.tsx b/app/canvas/[id]/page.tsx index 081ad5e0d..134d68a69 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