Skip to content

perf(refactor): consolidate getState calls in resolveWebviewView#11320

Open
0xMink wants to merge 1 commit intoRooCodeInc:mainfrom
0xMink:perf/consolidate-getstate-resolvewebview
Open

perf(refactor): consolidate getState calls in resolveWebviewView#11320
0xMink wants to merge 1 commit intoRooCodeInc:mainfrom
0xMink:perf/consolidate-getstate-resolvewebview

Conversation

@0xMink
Copy link

@0xMink 0xMink commented Feb 9, 2026

Summary

  • Consolidate three separate this.getState().then(...) calls into a single await this.getState() with destructuring in resolveWebviewView()
  • Eliminates two redundant executions of getState() which includes CloudService calls, ContextProxy reads, and other work
  • Uses a single snapshot, avoiding potential inconsistency if settings change mid-resolution
  • No behavioral change — same defaults, same setter calls, same values

Closes: #11319

Test plan

  • Existing ClineProvider.spec.ts tests pass (90/90, 6 skipped unchanged)
  • Verify terminal settings (shell integration timeout, command delay, zsh options) are applied correctly on webview load
  • Verify TTS enabled/speed settings are applied correctly on webview load

Important

Refactor resolveWebviewView in ClineProvider.ts to consolidate multiple getState calls into a single call, improving performance and consistency without changing behavior.

  • Refactor:
    • Consolidate three this.getState().then(...) calls into a single await this.getState() in resolveWebviewView() in ClineProvider.ts.
    • Use destructuring to extract state values in one go, reducing redundant getState() executions.
    • Maintain same defaults, setter calls, and values, ensuring no behavioral change.
  • Performance:
    • Eliminates redundant CloudService calls and ContextProxy reads by using a single state snapshot.
    • Avoids potential inconsistencies if settings change during multiple getState() calls.

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

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.
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Feb 9, 2026
@roomote
Copy link
Contributor

roomote bot commented Feb 9, 2026

Rooviewer Clock   See task

Clean refactor, no issues found. The consolidation from three fire-and-forget getState().then(...) calls into a single await this.getState() is correct -- defaults match, all setters are preserved, and the blocking await is actually an improvement since it guarantees settings are applied before the webview finishes setup.

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

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant