Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: use WEBVIEW_READY message instead of setTimeout#398

Merged
breaking-brake merged 2 commits intomainbreaking-brake/cc-wf-studio:mainfrom
fix/issue-396-webview-readybreaking-brake/cc-wf-studio:fix/issue-396-webview-readyCopy head branch name to clipboard
Jan 7, 2026
Merged

fix: use WEBVIEW_READY message instead of setTimeout#398
breaking-brake merged 2 commits intomainbreaking-brake/cc-wf-studio:mainfrom
fix/issue-396-webview-readybreaking-brake/cc-wf-studio:fix/issue-396-webview-readyCopy head branch name to clipboard

Conversation

@breaking-brake
Copy link
Copy Markdown
Owner

@breaking-brake breaking-brake commented Jan 7, 2026

Problem

When the Webview loads slowly (taking more than 500ms), the INITIAL_STATE message is sent before the Webview is ready to receive it, resulting in a blank page.

Current Behavior

  1. Extension Host sends INITIAL_STATE after a fixed 500ms delay
  2. ❌ If Webview takes longer to initialize, the message is lost
  3. ❌ User sees a blank page

Expected Behavior

  1. Extension Host waits for Webview to signal readiness
  2. INITIAL_STATE is sent only after Webview is fully initialized
  3. ✅ User sees the editor correctly

Solution

Replace the unreliable setTimeout(500ms) approach with an explicit WEBVIEW_READY message pattern, and show a loading spinner while waiting.

Changes

File: src/webview/src/main.tsx

  • Added vscode.postMessage({ type: 'WEBVIEW_READY' }) after React render completes

File: src/shared/types/messages.ts

  • Added WEBVIEW_READY message type to WebviewMessage union

File: src/extension/commands/open-editor.ts

  • Replaced setTimeout with message handler for WEBVIEW_READY
  • Extension Host now waits for this message before sending INITIAL_STATE

File: src/webview/src/components/common/Spinner.tsx (NEW)

  • Added reusable Spinner component with configurable size and thickness

File: src/webview/src/App.tsx

  • Show loading spinner while waiting for INITIAL_STATE message
  • Improves UX during slow initialization

Impact

  • ✅ Fixes blank page issue for users with slower environments
  • ✅ More reliable message timing (event-based vs time-based)
  • ✅ Shows loading spinner during initialization (better UX)
  • ✅ No breaking changes

Testing

  • Code quality checks passed (npm run format && npm run lint && npm run check)
  • Build successful (npm run build)
  • Awaiting confirmation from issue reporter

Notes

breaking-brake and others added 2 commits January 7, 2026 19:52
- Added WEBVIEW_READY message sent after React initialization
- Extension Host waits for this message before sending INITIAL_STATE
- Fixes #396: blank page when Webview loads slowly
- Added Spinner component for reusable loading indicator
- Show spinner while waiting for INITIAL_STATE message

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@breaking-brake breaking-brake merged commit f72f4b2 into main Jan 7, 2026
3 checks passed
@breaking-brake breaking-brake deleted the fix/issue-396-webview-ready branch January 7, 2026 12:36
@breaking-brake breaking-brake mentioned this pull request Jan 7, 2026
braking-brake-semantic-release Bot pushed a commit that referenced this pull request Jan 7, 2026
## [3.12.9](v3.12.8...v3.12.9) (2026-01-07)

### Bug Fixes

* resolve ConfirmDialog z-index issue in SubAgentFlowDialog ([#399](#399)) ([637c2fc](637c2fc))
* use WEBVIEW_READY message instead of setTimeout ([#398](#398)) ([f72f4b2](f72f4b2))

### Improvements

* add resizable width to AI editing panel ([#397](#397)) ([14918d2](14918d2))
@braking-brake-semantic-release
Copy link
Copy Markdown

🎉 This PR is included in version 3.12.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

installed from extension visual code. open editor and got blank page

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.