From ef0750b4ef782b75686d617c3ae5f021c1451ef8 Mon Sep 17 00:00:00 2001 From: cruldra Date: Sun, 13 Sep 2026 08:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(vscode):=20=E5=88=B7?= =?UTF-8?q?=E6=96=B0=E6=8C=89=E9=92=AE=E5=8A=A0=E8=BD=BD=E6=80=81=E5=8F=AF?= =?UTF-8?q?=E8=A7=81=EF=BC=8C=E5=9B=BE=E6=A0=87=E9=9A=8F=E9=87=8D=E6=8B=89?= =?UTF-8?q?=E8=BD=AC=E5=9C=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 刷新按钮此前只发消息重拉数据,看板已有列表时界面毫无变化,用户 无法判断点击是否生效。消息协议里的 issues/loading 从未被发送。 loadAndPush 现在在开跑前推 issues/loading,并在 finally 里推新增的 issues/loaded,保证成功、报错、缺 token 提前返回都能收尾;webhook 触发的自动重拉同样走这条链路。webview 据此维护 refreshing 状态, 刷新图标转圈并在期间禁用按钮。 Claude-Session: https://claude.ai/code/session_01REdhpbaNyqWASF2HWsnTFv --- vscode/package.json | 2 +- vscode/src/panel/KanbanPanel.ts | 4 ++++ vscode/src/panel/messages.ts | 1 + vscode/webview-ui/src/App.tsx | 4 ++++ vscode/webview-ui/src/components/PanelHeader.tsx | 11 ++++++++--- vscode/webview-ui/src/hooks/useIssues.ts | 12 +++++++++++- vscode/webview-ui/src/lib/messages.ts | 1 + 7 files changed, 30 insertions(+), 5 deletions(-) diff --git a/vscode/package.json b/vscode/package.json index c729764..9d78367 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -2,7 +2,7 @@ "publisher": "clurdra", "name": "superpowers-vscode-clurdra", "displayName": "Superpowers-clurdra", - "version": "0.2.125", + "version": "0.2.126", "packageManager": "pnpm@10.27.0", "description": "Superpowers specs and plans Kanban explorer", "author": "clurdra", diff --git a/vscode/src/panel/KanbanPanel.ts b/vscode/src/panel/KanbanPanel.ts index 93ecdbb..9b33d82 100644 --- a/vscode/src/panel/KanbanPanel.ts +++ b/vscode/src/panel/KanbanPanel.ts @@ -912,8 +912,12 @@ export class KanbanWebviewPanel { async loadAndPush(): Promise { if (this.loadInFlight) return this.loadInFlight + // 每次真正开跑都成对推 loading/loaded,webview 据此转刷新图标; + // 无论成功、报错还是缺 token 中途返回,finally 都会收尾。 + this.postMessage({ type: 'issues/loading' }) this.loadInFlight = this.loadAndPushInner().finally(() => { this.loadInFlight = undefined + this.postMessage({ type: 'issues/loaded' }) }) return this.loadInFlight } diff --git a/vscode/src/panel/messages.ts b/vscode/src/panel/messages.ts index 8d4eaf4..8c7e95b 100644 --- a/vscode/src/panel/messages.ts +++ b/vscode/src/panel/messages.ts @@ -49,6 +49,7 @@ export type ToastLevel = 'info' | 'success' | 'error' export type ExtensionToWebview = | { type: 'issues/loading' } + | { type: 'issues/loaded' } | { type: 'issues/update', issues: Issue[], scope: 'mine' | 'all', globalAutoReview: boolean, youtrackConfigured: boolean, me?: string, avatars?: Record } | { type: 'issues/error', message: string } | { type: 'issue/patch', issueNumber: number, patch: { autoReview?: boolean, specFile?: string, planFile?: string, prDiffFile?: string | null, sessionId?: string | null, implementSessionId?: string | null, reviewSessionId?: string | null, reviewSessionFileExists?: boolean, testSessionId?: string | null, pr?: string | null, implementStatus?: 'running' | 'done' | 'failed' | null, column?: IssueColumn, worktreePath?: string | null, prMerged?: boolean, prMergedAt?: string | null, branch?: string | null, color?: string, worktreeExists?: boolean, brainstormTabOpen?: boolean, implementTabOpen?: boolean, reviewTabOpen?: boolean, testTabOpen?: boolean, profilePath?: string | null, brainstormProfilePath?: string | null, testProfilePath?: string | null, assignees?: string[], handoffAttachmentId?: string | null, handoffFrom?: string | null } } diff --git a/vscode/webview-ui/src/App.tsx b/vscode/webview-ui/src/App.tsx index 276c28b..16e2e29 100644 --- a/vscode/webview-ui/src/App.tsx +++ b/vscode/webview-ui/src/App.tsx @@ -30,6 +30,7 @@ export function App() { avatars, setIssues, refresh, + refreshing, saveSettings, listYouTrackProjects, youtrackProjects, @@ -305,6 +306,7 @@ export function App() { <> void + /** host 正在重拉看板;为 true 时刷新图标转起来。 */ + refreshing: boolean /** 看板范围:'mine' 只看我的(assigned/created),'all' 团队全部工单。 */ scope: 'mine' | 'all' onToggleScope: () => void @@ -65,6 +67,7 @@ function releaseTitle(release: ReleaseStatus | undefined): string { export function PanelHeader({ onRefresh, + refreshing, scope, onToggleScope, onEditAuth, @@ -207,11 +210,13 @@ export function PanelHeader({