From 81ab00bdbae38e56982b75272be0be9edeb3be5f Mon Sep 17 00:00:00 2001 From: cruldra Date: Wed, 5 Aug 2026 14:39:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(vscode):=20=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=B1=9E=E6=80=A7=E6=A0=BC=20data=20=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E5=8F=98=E5=8C=96=E4=B8=8D=E5=86=8D=E6=B8=85=E6=8E=89?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E5=AF=BC=E8=87=B4=20PR=20=E6=89=93=E4=B8=8D?= =?UTF-8?q?=E5=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/IssueDetailPanel.tsx | 55 +++++++++++-------- .../src/components/property-grid.tsx | 20 +++---- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/vscode/webview-ui/src/components/IssueDetailPanel.tsx b/vscode/webview-ui/src/components/IssueDetailPanel.tsx index b614e16..3f3d3be 100644 --- a/vscode/webview-ui/src/components/IssueDetailPanel.tsx +++ b/vscode/webview-ui/src/components/IssueDetailPanel.tsx @@ -491,7 +491,37 @@ export function IssueDetailPanel({ [onResumeSession, onResumeReviewSession, onResumeTestSession, onStartTestSession, onOpenFile, onImplement, onOpenPr, onGeneratePrDiffSummary, onOpenWorktree, onDeleteWorktree, onMergeBranch, onCloseSessionTab, onStartBrainstormSession, onOpenLogs, issue, locked, lockTitle, globalAutoReview, prDiffSummaryRunning, profiles], ) - if (!issue) { + const data = useMemo | null>(() => { + if (!issue) + return null + return { + column: issue.column, + sessionId: issue.sessionId ?? null, + implementSessionId: issue.implementSessionId ?? null, + reviewSessionId: issue.reviewSessionId ?? null, + testSessionId: issue.testSessionId ?? null, + autoReview: issue.autoReview ?? globalAutoReview, + color: issue.color ?? null, + // 展示/选中值按 basename 映射到本机 profiles,避免跨机绝对路径变成「自定义」项。 + brainstormProfilePath: matchProfileOption(issue.brainstormProfilePath, profiles) || null, + profilePath: matchProfileOption(issue.profilePath, profiles) || null, + testProfilePath: matchProfileOption(issue.testProfilePath, profiles) || null, + specFile: issue.specFile ?? null, + planFile: issue.planFile ?? null, + prDiffFile: issue.prDiffFile ?? null, + pr: issue.pr + ? `${issue.pr}${issue.prMerged ? '(已合并)' : ''}` + : null, + branch: issue.branch ?? null, + worktreePath: issue.worktreePath ?? null, + } + }, [ + issue, + globalAutoReview, + profiles, + ]) + + if (!issue || !data) { return (
按方向键或点击卡片查看详情 @@ -499,28 +529,6 @@ export function IssueDetailPanel({ ) } - const data: Record = { - column: issue.column, - sessionId: issue.sessionId ?? null, - implementSessionId: issue.implementSessionId ?? null, - reviewSessionId: issue.reviewSessionId ?? null, - testSessionId: issue.testSessionId ?? null, - autoReview: issue.autoReview ?? globalAutoReview, - color: issue.color ?? null, - // 展示/选中值按 basename 映射到本机 profiles,避免跨机绝对路径变成「自定义」项。 - brainstormProfilePath: matchProfileOption(issue.brainstormProfilePath, profiles) || null, - profilePath: matchProfileOption(issue.profilePath, profiles) || null, - testProfilePath: matchProfileOption(issue.testProfilePath, profiles) || null, - specFile: issue.specFile ?? null, - planFile: issue.planFile ?? null, - prDiffFile: issue.prDiffFile ?? null, - pr: issue.pr - ? `${issue.pr}${issue.prMerged ? '(已合并)' : ''}` - : null, - branch: issue.branch ?? null, - worktreePath: issue.worktreePath ?? null, - } - return (
@@ -608,6 +616,7 @@ export function IssueDetailPanel({
registerCellRef(fullKey, el)} data-property-cell={fullKey} onClickCapture={(e) => { - if (!isSelected) { - e.stopPropagation() - e.preventDefault() - onSelect(fullKey) - } + if (isSelected) + return + onSelect(fullKey) + // 点在 action/file-link/pr-link 按钮上:只选中,不拦截,让 click 落到 primary + const t = e.target + if (t instanceof Element && t.closest('[data-property-action]')) + return + e.stopPropagation() + e.preventDefault() }} className={`flex min-w-0 flex-1 ${ propDef.type === 'multiline' ? 'items-stretch' : 'items-center' @@ -568,12 +572,8 @@ export function PropertyGrid({ const rootRef = useRef(null) const cellRefsRef = useRef>(new Map()) - /** 切换到新 data 时清空选中 */ - useEffect(() => { - setSelectedKey(null) - }, [data]) - /** 点击网格外部时清空选中 */ + useEffect(() => { if (selectedKey == null) return