Skip to content

Commit 2789bab

Browse files
0xMinkdaniel-lxs
andauthored
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 <ricciodaniel98@gmail.com>
1 parent 99a2e3b commit 2789bab

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/core/webview/ClineProvider.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ export class ClineProvider
757757
terminalZshP10k = false,
758758
terminalPowershellCounter = false,
759759
terminalZdotdir = false,
760+
ttsEnabled,
761+
ttsSpeed,
760762
}) => {
761763
Terminal.setShellIntegrationTimeout(terminalShellIntegrationTimeout)
762764
Terminal.setShellIntegrationDisabled(terminalShellIntegrationDisabled)
@@ -766,17 +768,11 @@ export class ClineProvider
766768
Terminal.setTerminalZshP10k(terminalZshP10k)
767769
Terminal.setPowershellCounter(terminalPowershellCounter)
768770
Terminal.setTerminalZdotdir(terminalZdotdir)
771+
setTtsEnabled(ttsEnabled ?? false)
772+
setTtsSpeed(ttsSpeed ?? 1)
769773
},
770774
)
771775

772-
this.getState().then(({ ttsEnabled }) => {
773-
setTtsEnabled(ttsEnabled ?? false)
774-
})
775-
776-
this.getState().then(({ ttsSpeed }) => {
777-
setTtsSpeed(ttsSpeed ?? 1)
778-
})
779-
780776
// Set up webview options with proper resource roots
781777
const resourceRoots = [this.contextProxy.extensionUri]
782778

0 commit comments

Comments
 (0)