From 2789baba96862959d4eace09a98da4963dd37a61 Mon Sep 17 00:00:00 2001 From: 0xMink Date: Mon, 9 Feb 2026 10:11:38 -0500 Subject: [PATCH] perf(refactor): consolidate getState calls in resolveWebviewView (#11320) * perf(refactor): consolidate getState calls in resolveWebviewView Replace three separate this.getState().then() calls with a single await this.getState() and destructuring. This avoids running the full getState() method (CloudService calls, ContextProxy reads, etc.) three times during webview view resolution. * fix: keep getState consolidation non-blocking to avoid delaying webview render --------- Co-authored-by: daniel-lxs --- src/core/webview/ClineProvider.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index fc15a8dd5c..f18b7b7983 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -757,6 +757,8 @@ export class ClineProvider terminalZshP10k = false, terminalPowershellCounter = false, terminalZdotdir = false, + ttsEnabled, + ttsSpeed, }) => { Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout) Terminal.setShellIntegrationDisabled(terminalShellIntegrationDisabled) @@ -766,17 +768,11 @@ export class ClineProvider Terminal.setTerminalZshP10k(terminalZshP10k) Terminal.setPowershellCounter(terminalPowershellCounter) Terminal.setTerminalZdotdir(terminalZdotdir) + setTtsEnabled(ttsEnabled ?? false) + setTtsSpeed(ttsSpeed ?? 1) }, ) - this.getState().then(({ ttsEnabled }) => { - setTtsEnabled(ttsEnabled ?? false) - }) - - this.getState().then(({ ttsSpeed }) => { - setTtsSpeed(ttsSpeed ?? 1) - }) - // Set up webview options with proper resource roots const resourceRoots = [this.contextProxy.extensionUri]