Skip to content

fix: resolve macOS 12 window not showing (WebKit TLA bug) - #96

Merged
delibae merged 1 commit into
mainfrom
fix/macos12-window-not-showing
Mar 26, 2026
Merged

delibae merged 1 commit into
mainfrom
fix/macos12-window-not-showing

Conversation

@delibae

@delibae delibae commented Mar 26, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #95 — On macOS 12 (Monterey), ClaudePrism launches but no main window appears (count windows = 0).

Root cause: WebKit Bug #242740 — Safari 15's WKWebView has a race condition with top-level await in ES modules, causing silent JS failure. Since the window starts with visible: false and relies on JS calling getCurrentWindow().show(), the window stays permanently hidden.

Changes

  • Vite build target: esnext → safari14 (macOS) / chrome105 (Windows), matching Tauri's recommended config
  • TLA plugin: Added vite-plugin-top-level-await to transform top-level await into Promise chains compatible with older WebKit
  • main.tsx: Replaced await import("./App") with .then() chain to eliminate TLA at source level
  • Rust safety net: Added 8-second timeout in setup() that force-shows the main window if JS never signals readiness

References

Test plan

  • Verify app launches and window appears on macOS 12 (Monterey)
  • Verify app still works normally on macOS 13+ (Ventura/Sonoma/Sequoia)
  • Verify app works on Windows
  • Verify new window creation (Cmd+N) still works
  • Verify the 8s timeout does not cause double-show flicker on normal startup

🤖 Generated with Claude Code

…t bug

On macOS 12 (Monterey), the app launches but no main window appears.
The root cause is WebKit bug #242740: Safari 15's WKWebView has a race
condition with top-level await in ES modules, causing silent JS failure
that prevents `getCurrentWindow().show()` from ever being called.

Three complementary fixes:

1. Change Vite build target from `esnext` to `safari14` (Tauri recommended)
   and add `vite-plugin-top-level-await` to transform TLA into compatible
   Promise chains, avoiding the WebKit bug entirely.

2. Replace top-level `await import("./App")` in main.tsx with a `.then()`
   chain, removing TLA dependency at the source level.

3. Add a Rust-side 8-second timeout safety net in `setup()` that
   force-shows the main window if the frontend JS fails to do so,
   preventing permanently hidden windows regardless of the failure cause.

Closes #95

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@delibae
delibae merged commit 3bce19d into main Mar 26, 2026
1 check passed
zihenghe04 added a commit to zihenghe04/claude-prism that referenced this pull request Sep 17, 2026
…wing

fix: resolve macOS 12 window not showing (WebKit TLA bug)
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.

macOS 12: app launches, WebKit processes start, but no main window is created (count windows = 0)

1 participant