Skip to content

Commit 8942282

Browse files
author
Eric Wheeler
committed
fix: ensure all Cline instances update history UI for new tasks
Refactors state update logic to ensure that when task history is modified (e.g., a new task is created or status changes), all active ClineProvider instances (sidebar and editor tabs) receive the updated state and refresh their UI. The `postStateToWebview()` call is removed from `Task.addToClineMessages()` and is now handled within `ClineProvider.updateTaskHistory()`, which iterates over all active instances to broadcast the new state. This guarantees timely UI updates across all open views. Signed-off-by: Eric Wheeler <[email protected]>
1 parent 7539ab4 commit 8942282

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/core/task/Task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ export class Task extends EventEmitter<ClineEvents> {
321321

322322
private async addToClineMessages(message: ClineMessage) {
323323
this.clineMessages.push(message)
324-
await this.providerRef.deref()?.postStateToWebview()
324+
// Removed direct call to postStateToWebview(), ClineProvider.updateTaskHistory will handle it
325325
this.emit("message", { action: "created", message })
326326
await this.saveClineMessages()
327327
}

src/core/webview/ClineProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,12 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
14461446
}
14471447

14481448
await this.updateGlobalState("taskHistory", history)
1449+
1450+
// Post the updated state to all active webview instances
1451+
for (const instance of ClineProvider.activeInstances) {
1452+
await instance.postStateToWebview()
1453+
}
1454+
14491455
return history
14501456
}
14511457

0 commit comments

Comments
 (0)