mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
refactor: simplify postStateToWebview by removing incremental message delivery logic
This commit is contained in:
parent
26e0786ddc
commit
72bdae1acb
1 changed files with 1 additions and 23 deletions
|
|
@ -9,9 +9,6 @@ import axios from "axios"
|
|||
import pWaitFor from "p-wait-for"
|
||||
import * as vscode from "vscode"
|
||||
|
||||
// Small delay used for incremental message delivery to the webview
|
||||
const INCREMENTAL_SEND_DELAY_MS = 10
|
||||
|
||||
import {
|
||||
type TaskProviderLike,
|
||||
type TaskProviderEvents,
|
||||
|
|
@ -1561,26 +1558,7 @@ export class ClineProvider
|
|||
|
||||
async postStateToWebview() {
|
||||
const state = await this.getStateToPostToWebview()
|
||||
|
||||
// Check if we're loading an existing task with messages
|
||||
const currentCline = this.getCurrentCline()
|
||||
const hasExistingMessages = currentCline && currentCline.clineMessages.length > 0
|
||||
|
||||
if (hasExistingMessages) {
|
||||
// Send state without messages first
|
||||
const stateWithoutMessages = { ...state, clineMessages: [] }
|
||||
await this.postMessageToWebview({ type: "state", state: stateWithoutMessages })
|
||||
|
||||
// Then send messages incrementally with a small delay for smooth rendering
|
||||
for (const message of currentCline.clineMessages) {
|
||||
await this.postMessageToWebview({ type: "messageCreated", clineMessage: message })
|
||||
// Small delay to prevent overwhelming the webview
|
||||
await delay(INCREMENTAL_SEND_DELAY_MS)
|
||||
}
|
||||
} else {
|
||||
// Normal state update for new tasks or tasks without messages
|
||||
await this.postMessageToWebview({ type: "state", state })
|
||||
}
|
||||
await this.postMessageToWebview({ type: "state", state })
|
||||
|
||||
// Check MDM compliance and send user to account tab if not compliant
|
||||
if (!this.checkMdmCompliance()) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue