From 1f1afa37b6d18bfce524ec5300b86335b65803e4 Mon Sep 17 00:00:00 2001 From: Yaojia Wang Date: Mon, 22 Jun 2026 18:32:18 +0200 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E5=86=99=E4=BD=9C=E9=A1=B5?= =?UTF-8?q?=E5=88=87=E7=AB=A0=E5=90=8E=E5=86=85=E5=AE=B9=E4=B8=8D=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E2=80=94=E2=80=94=E7=BB=99=20Workbench=20=E5=8A=A0=20?= =?UTF-8?q?key=3DchapterNo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 客户端按 ?chapter=N 切章时 React 复用 Workbench 实例,useState(initialText)/ autosave 基线沿用上一章导致显示旧内容。以章号为 key 强制重挂载即用新章草稿刷新。 Co-Authored-By: Claude Opus 4.8 (1M context) --- apps/web/app/projects/[id]/write/page.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/web/app/projects/[id]/write/page.tsx b/apps/web/app/projects/[id]/write/page.tsx index a481539..77f8b23 100644 --- a/apps/web/app/projects/[id]/write/page.tsx +++ b/apps/web/app/projects/[id]/write/page.tsx @@ -43,7 +43,10 @@ export default async function WritePage({ params, searchParams }: PageProps) { })); return ( + // key=章号:客户端切章(?chapter=N 变化)时强制重挂载,用新章草稿刷新编辑器状态, + // 避免 Workbench 内 useState(initialText)/autosave 基线沿用上一章而显示旧内容。