🐛 fix(vscode): 刷新按钮加载态可见,图标随重拉转圈

刷新按钮此前只发消息重拉数据,看板已有列表时界面毫无变化,用户
无法判断点击是否生效。消息协议里的 issues/loading 从未被发送。

loadAndPush 现在在开跑前推 issues/loading,并在 finally 里推新增的
issues/loaded,保证成功、报错、缺 token 提前返回都能收尾;webhook
触发的自动重拉同样走这条链路。webview 据此维护 refreshing 状态,
刷新图标转圈并在期间禁用按钮。

Claude-Session: https://claude.ai/code/session_01REdhpbaNyqWASF2HWsnTFv
This commit is contained in:
cruldra committed 2026-09-13 08:22:38 +08:00
1 parent 9167b86708
commit ef0750b4ef
7 files changed
+30 -5

No files matched your search

+4
View File
@@ -912,8 +912,12 @@ export class KanbanWebviewPanel {
async loadAndPush(): Promise<void> {
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
}
+1
View File
@@ -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<string, string> }
| { 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 } }