🐛 fix(vscode): issue/patch 用 null 清空 worktree 字段以便 webview 即时刷新
This commit is contained in:
@@ -23,6 +23,16 @@ import type { LogEntry } from '../lib/messages'
|
||||
import { compareIssuesInColumn } from '../lib/issueSort'
|
||||
import { onMessage, postMessage } from '../lib/vscode'
|
||||
|
||||
/** postMessage 用 null 清空 optional 字段;合并时 delete 还原 optional,避免残留 null */
|
||||
function applyIssuePatch(issue: Issue, patch: Record<string, unknown>): Issue {
|
||||
const next = { ...issue, ...patch } as Issue & Record<string, unknown>
|
||||
for (const [k, v] of Object.entries(patch)) {
|
||||
if (v === null)
|
||||
delete next[k]
|
||||
}
|
||||
return next as Issue
|
||||
}
|
||||
|
||||
export interface SettingsValues {
|
||||
host: string
|
||||
token: string
|
||||
@@ -560,7 +570,7 @@ export function useIssues(): UseIssuesResult {
|
||||
return {
|
||||
status: 'ready',
|
||||
issues: prev.issues.map(i =>
|
||||
i.number === msg.issueNumber ? { ...i, ...msg.patch } : i,
|
||||
i.number === msg.issueNumber ? applyIssuePatch(i, msg.patch) : i,
|
||||
),
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user