Skip to content

perf: consolidate three getState() calls into single await in resolveWebviewView#11321

Draft
roomote[bot] wants to merge 1 commit intomainfrom
perf/consolidate-getstate-resolvewebviewview
Draft

perf: consolidate three getState() calls into single await in resolveWebviewView#11321
roomote[bot] wants to merge 1 commit intomainfrom
perf/consolidate-getstate-resolvewebviewview

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 9, 2026

This PR attempts to address Issue #11319 by consolidating three separate this.getState().then(...) calls into a single await this.getState() with destructuring in resolveWebviewView().

Changes

  • Replace three independent this.getState().then(...) calls (terminal settings, ttsEnabled, ttsSpeed) with a single await this.getState() and destructuring
  • Same defaults preserved: terminalShellIntegrationTimeout = Terminal.defaultShellIntegrationTimeout, ttsEnabled ?? false, ttsSpeed ?? 1, etc.
  • No behavioral change -- same setter calls, same values, same error propagation

Why

  • Eliminates ~2 redundant async getState() executions during view activation
  • Ensures a single consistent settings snapshot (avoids potential inconsistency if state changes mid-resolution)
  • resolveWebviewView is already async, so await is idiomatic here

Test plan

  • All ClineProvider tests pass (88 passed, 6 skipped in main spec; 52 passed across related specs)
  • Lint: 14/14 passed
  • Type check: 14/14 passed

Closes #11319. Feedback and guidance are welcome.


Important

Consolidates multiple getState() calls into a single await with destructuring in resolveWebviewView() of ClineProvider.ts, improving performance and consistency without changing behavior.

  • Behavior:
    • Consolidates three this.getState().then(...) calls into a single await this.getState() with destructuring in resolveWebviewView() in ClineProvider.ts.
    • Preserves defaults: terminalShellIntegrationTimeout, ttsEnabled, ttsSpeed, etc.
    • No change in behavior: same setter calls, values, and error handling.
  • Performance:
    • Reduces redundant async getState() calls from three to one.
    • Ensures consistent settings snapshot during view activation.
  • Misc:
    • resolveWebviewView remains async, aligning with idiomatic usage.

This description was created by Ellipsis for 53fffd8. You can customize this summary. It will automatically update as commits are pushed.

@roomote
Copy link
Contributor Author

roomote bot commented Feb 9, 2026

Rooviewer Clock   See task

Review complete. No issues found. The consolidation of three fire-and-forget getState().then() calls into a single await getState() with destructuring is correct -- all defaults, nullish coalescing, and setter calls are preserved.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PERF] resolveWebviewView triggers redundant getState() calls (x3)

1 participant