From a0ffb6fc8eb0ca5415ae3ecafe41bba4a292caf1 Mon Sep 17 00:00:00 2001 From: zyc <1439655764@qq.com> Date: Tue, 16 Jun 2026 18:27:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E5=BD=BB=E5=BA=95=E4=BF=AE?= =?UTF-8?q?=E8=BF=9B=E5=85=A5=E6=96=B0=E5=BB=BA=E9=A1=B9=E7=9B=AE=E4=B8=B2?= =?UTF-8?q?=E5=8F=B0=E6=97=A7=E9=A1=B9=E7=9B=AE=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 上一版没根治:action() 的后台 refreshProjectDetail 用旧 activeProjectId 拉到旧项目, 异步写回 projectDetail,而 pipelineProject=projectDetail||activeProject 无条件优先用它, 导致刚建的空项目仍渲染上一个项目的脚本(实测 Playwright 复现)。 改为渲染时校验 projectDetail.id===activeProjectId 才采用,否则回退 activeProject(列表项 已含完整嵌套脚本)。配合上一版的乐观 setProjectDetail/插入 projects + key=project.id, 新建项目即时显示空态+行30 三选项。 Co-Authored-By: Claude Opus 4.8 --- core/frontend/src/App.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/frontend/src/App.tsx b/core/frontend/src/App.tsx index 635376e..58a81f5 100644 --- a/core/frontend/src/App.tsx +++ b/core/frontend/src/App.tsx @@ -326,6 +326,7 @@ export function App() { async function refreshProjectDetail() { if (!activeProjectId) return; const detail = await api.project(activeProjectId).catch(() => null); + // 写进 projectDetail;渲染处 pipelineProject 会校验 id 是否仍是当前激活项目,故后台旧请求写回也不会串台 if (detail) setProjectDetail(detail); } @@ -658,7 +659,9 @@ export function App() { const here = crumbLabels[page] || routeLabels[page] || "工作台"; // 生产管线 · 全屏 bespoke 布局(自带顶栏 + 步进器),脱离常规 shell - const pipelineProject = projectDetail || activeProject; + // projectDetail 只有在确实是当前激活项目时才用;否则回退 activeProject。 + // 否则后台 refreshProjectDetail 拿旧 id 的结果会把刚进入的新项目串成上一个项目(实测发现)。 + const pipelineProject = projectDetail && projectDetail.id === activeProjectId ? projectDetail : activeProject; if (page === "pipeline" && pipelineProject) { const textModel = modelConfigs.find((m) => m.capability === "text" && m.status === "active") || modelConfigs.find((m) => m.capability === "text"); return (