Skip to content

Commit 08f1bef

Browse files
refactor(webview): clarify throttled state semantics
Document the distinction between scheduling and flushing throttled state updates. Use the typed abort event in ordering coverage. Signed-off-by: JunyongParkDev <jun94.park@samsung.com>
1 parent 3eb6271 commit 08f1bef

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/core/task/__tests__/Task.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ describe("Cline", () => {
19071907
await task.abortTask()
19081908

19091909
const taskAbortedCallIndex = (emitSpy.mock.calls as unknown[][]).findIndex(
1910-
([event]) => event === "taskAborted",
1910+
([event]) => event === RooCodeEventName.TaskAborted,
19111911
)
19121912
expect(taskAbortedCallIndex).toBeGreaterThanOrEqual(0)
19131913
expect(queuedMessagesAtFlush).toBe(1)

src/core/webview/ClineProvider.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,12 @@ export class ClineProvider
21952195
await this.postMessageToWebview({ type: "state", state: rest })
21962196
}
21972197

2198+
/**
2199+
* Schedules a debounced state-post attempt. A call made while the debounce timer is active returns
2200+
* the result of the most recent invocation, so awaiting this method does not wait for the trailing
2201+
* invocation scheduled by that call. Use `flushPostStateToWebviewThrottled()` to force and await any
2202+
* pending trailing invocation before continuing.
2203+
*/
21982204
async postStateToWebviewThrottled(): Promise<void> {
21992205
if (this._disposed) {
22002206
return

0 commit comments

Comments
 (0)