Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(shell): reveal the main window when the frontend handshake never arrives (#266)

2 months ago

dffb487
Authored
Davy7/26/2026, 11:11:21 AM
The main window starts hidden and only `window_ready` shows it. macOS
suspends animation frames *and* JS timers in a WKWebView whose window
has never been shown, so neither the rAF reveal nor its 120ms timer
backstop runs and the app becomes an invisible process the user can
only kill from Activity Monitor.

Add a native watchdog spawned as the last step of setup_app: after 2s
it warns and shows the window if it is still hidden. The deadline
starts at the end of setup because Tauri serves no IPC until the setup
hook returns, and 2s leaves better than 2x headroom over the healthy
handshake budget (750ms native-setTheme guard + 120ms reveal backstop
plus two local IPC reads), so the flash-free path still wins.

ErrorBoundary.componentDidCatch also asks for the reveal. The watchdog
covers a render crash too, but the boundary knows at the instant of the
crash, so the existing crash panel appears immediately instead of after
a blank pause.

Deliberately no unconditional on_page_load reveal: `:root` defaults to
the dark token set and `data-theme` is only written after settings
hydrate, so revealing at load-finished would preempt the theme gate on
every launch and flash dark before light for light-theme users.

Closes #260

Parent3b2b4b0

3 files changed
  • src-tauri/src/app_runtime.rs+50−0
  • src/components/ErrorBoundary.test.tsx+38−1
  • src/components/ErrorBoundary.tsx+7−0