Skip to content

Commit 72bdae1

Browse files
daniel-lxsroomote
authored andcommitted
refactor: simplify postStateToWebview by removing incremental message delivery logic
1 parent 26e0786 commit 72bdae1

File tree

1 file changed

+1
-23
lines changed

1 file changed

+1
-23
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ import axios from "axios"
99
import pWaitFor from "p-wait-for"
1010
import * as vscode from "vscode"
1111

12-
// Small delay used for incremental message delivery to the webview
13-
const INCREMENTAL_SEND_DELAY_MS = 10
14-
1512
import {
1613
type TaskProviderLike,
1714
type TaskProviderEvents,
@@ -1561,26 +1558,7 @@ export class ClineProvider
15611558

15621559
async postStateToWebview() {
15631560
const state = await this.getStateToPostToWebview()
1564-
1565-
// Check if we're loading an existing task with messages
1566-
const currentCline = this.getCurrentCline()
1567-
const hasExistingMessages = currentCline && currentCline.clineMessages.length > 0
1568-
1569-
if (hasExistingMessages) {
1570-
// Send state without messages first
1571-
const stateWithoutMessages = { ...state, clineMessages: [] }
1572-
await this.postMessageToWebview({ type: "state", state: stateWithoutMessages })
1573-
1574-
// Then send messages incrementally with a small delay for smooth rendering
1575-
for (const message of currentCline.clineMessages) {
1576-
await this.postMessageToWebview({ type: "messageCreated", clineMessage: message })
1577-
// Small delay to prevent overwhelming the webview
1578-
await delay(INCREMENTAL_SEND_DELAY_MS)
1579-
}
1580-
} else {
1581-
// Normal state update for new tasks or tasks without messages
1582-
await this.postMessageToWebview({ type: "state", state })
1583-
}
1561+
await this.postMessageToWebview({ type: "state", state })
15841562

15851563
// Check MDM compliance and send user to account tab if not compliant
15861564
if (!this.checkMdmCompliance()) {

0 commit comments

Comments
 (0)