From 36e8f736e67ea50e169ba2b6c6c09775ac655502 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sun, 14 Jun 2026 14:23:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20renderPreview=20=E4=B8=AD=20task=20?= =?UTF-8?q?=E5=8F=98=E9=87=8F=E9=81=AE=E8=94=BD=E5=85=A8=E5=B1=80=20t()=20?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=87=BD=E6=95=B0=E5=AF=BC=E8=87=B4=E9=A2=84?= =?UTF-8?q?=E8=A7=88=E7=82=B9=E5=87=BB=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 将 renderPreview 内 const t = tasks.find() 改名为 task, 避免局部变量 t(任务对象)遮蔽全局翻译函数 t(), 使预览面板渲染时抛 't is not a function' 导致面板无法打开。 Co-Authored-By: Claude Sonnet 4.6 --- web/app.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/web/app.js b/web/app.js index 915716c..3820116 100644 --- a/web/app.js +++ b/web/app.js @@ -1191,14 +1191,14 @@ function renderTranscript(messages) { function renderPreview() { const root = $('#previewRoot'); if (!S.previewId) { root.hidden = true; root.innerHTML = ''; return; } - const t = S.approvals.find((x) => x.id === S.previewId) || S.tasks.find((x) => x.id === S.previewId); + const task = S.approvals.find((x) => x.id === S.previewId) || S.tasks.find((x) => x.id === S.previewId); // 任务已离开闸(被裁决/状态变化)→ 自动关闭 - if (!t || !GATE_OF[t.status]) { S.previewId = null; S.previewReject = false; root.hidden = true; root.innerHTML = ''; return; } - const gate = GATE_OF[t.status]; + if (!task || !GATE_OF[task.status]) { S.previewId = null; S.previewReject = false; root.hidden = true; root.innerHTML = ''; return; } + const gate = GATE_OF[task.status]; const pp = S.projects.find((x) => x.id === S.currentProjectId); const defBranch = pp ? pp.defaultBranch : 'main'; const onlyPassBtn = gate === 'exec' - ? `` + ? `` : ''; root.hidden = false; root.innerHTML = ` @@ -1206,28 +1206,28 @@ function renderPreview() {
${gateLabel(gate)} - ${esc(t.title)} - ${cplxBadge(t.complexity)} - ${statusChip(t.status)} + ${esc(task.title)} + ${cplxBadge(task.complexity)} + ${statusChip(task.status)}
-
${gateDocs(t)}
+
${gateDocs(task)}
- ${onlyPassBtn} - + ${onlyPassBtn} + ${gate === 'exec' ? `${t('gateMergeNote', { branch: esc(defBranch) })}` : ''} - id ${esc(t.id)} · ${fmtTime(t.updatedAt)} + id ${esc(task.id)} · ${fmtTime(task.updatedAt)} ${S.previewReject ? `
- - - + + +
` : ''}
`; if (S.previewReject) { - const ta = document.getElementById(`prev-rej-${t.id}`); + const ta = document.getElementById(`prev-rej-${task.id}`); if (ta) ta.focus(); } }