Home

dev / openkara

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

fix(shell): stop the launch flash and reveal the window only once it can paint (#239) (#242)

2 months ago

fc280cd
Authored
Davy7/26/2026, 2:54:16 AM
The "start hidden, show on first paint" protection was silently dead. `visible:
false` lived only in the base tauri.conf.json, but every platform override
redefines the whole `app.windows` array, and Tauri merges platform config with
RFC 7396 JSON Merge Patch — where an array in the patch replaces the base array
wholesale rather than merging per window. `visible` therefore fell back to its
default of true on every desktop platform (taking `center` with it), so the
window was on screen for the entire webview load and `window_ready` →
`window.show()` was a no-op. The exposed white frame came from the WebView's
default opaque white surface, reinforced on macOS by an NSWindow background of
`windowBackgroundColor` (near-white in Light appearance).

Repeat `visible:false`, `center`, and a dark `backgroundColor` in every platform
window object, pin the macOS NSWindow backing to the app shell's dark surface,
declare `color-scheme` so the engine's default canvas is dark before any CSS
loads, and render a dark app-shell skeleton instead of nothing while the library
probe is in flight. A Rust test asserts every platform window carries these keys
so the array-replacement trap cannot silently return.

Making the window genuinely start hidden exposed a latent defect in the reveal
path: the request was scheduled inside requestAnimationFrame, and macOS suspends
animation frames for a hidden WebView, so the app ran with no window at all
(verified against a dev build). Arm a short timer alongside the frame so the
reveal always goes out, with the frame still winning when frames are produced.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

Parentc8d36ba

12 files changed
  • index.html+3−0
  • src-tauri/src/macos/window_shell.m+9−1
  • src-tauri/tauri.conf.json+2−1
  • src-tauri/tauri.linux.conf.json+4−1
  • src-tauri/tauri.macos.conf.json+4−1
  • src-tauri/tauri.windows.conf.json+4−1
  • src-tauri/tests/window_config_flash_guard.rs+81−0
  • src/App.test.tsx+7−2
  • src/App.tsx+2−1
  • src/components/Layout/AppShellSkeleton.tsx+33−0
  • src/runtime/app-ready-runtime.test.tsx+134−0
  • src/runtime/app-runtime.ts+20−2