Uh oh!
There was an error while loading. Please reload this page.
fix(desktop): reveal main window only after first React commit - #599
Merged
Conversation
The BrowserWindow showed immediately (show: true) while React mount waits on the onboarding snapshot prefetch (up to 2.5s), so every launch exposed the index.html .maka-preload skeleton — users read it as a bug. Create the window hidden and reveal it when the renderer signals its first React commit via window:notifyRendererReady, with a 4s fallback timer so a wedged renderer can never leave the window invisible. Visual-smoke / E2E startHidden windows stay hidden for their whole life; the skeleton remains as a reload-time anti-flash layer only.
…commit ChatGPT Pro review P2: controller focus() called mainWindow.show() directly, so re-launching the app or clicking the dock icon during the pre-commit window would flash the .maka-preload skeleton past the reveal gate. Route focus() through a readiness-aware gate that defers the request and flushes it (restore+show+focus) when the renderer signals ready or the fallback timer fires; keepHidden (visual-smoke / E2E) windows never show or take focus from any path.
ChatGPT Pro review P2 (round 2): BrowserWindow.maximize() reveals a still-hidden window (verified on macOS), so restoring a persisted isMaximized state in createWindow() bypassed the reveal gate — users who closed the app maximized saw the skeleton again on every launch. Route the restore through revealGate.requestMaximize(): the intent is held until markReady, which applies it right before the reveal so the first visible frame is already maximized. keepHidden (visual-smoke / E2E) windows never maximize from any path.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Create the main BrowserWindow hidden and reveal it only after the renderer's first React commit (via a new
window:notifyRendererReadyIPC), with a 4s fallback timer. Users no longer see the.maka-preloadstartup skeleton card on every launch.Why
User report: "every time I open the app there's a placeholder box — feels like a bug." The window showed immediately (
show: true) while React mount waits on the onboarding snapshot prefetch (#525, up to 2.5s fallback), so every launch exposed the index.html skeleton — worst case for 2.5s on slow machines. This flips the causality: the window waits for content instead of content decorating a premature window, removing the whole class of startup-flash issues (#429, #493, #525 patched individual layers of it).Scope
Changed:
main-window.ts:show: falsealways; reveal via shared gate on renderer-ready signal or 4s fallback; timer cleared on close.window-reveal.ts(new): pure reveal gate — idempotent (isVisible()guard, no focus stealing on HMR re-signal), never revealsstartHidden(visual-smoke/E2E) windows, testable without Electron.main.ts/preload.ts/global.d.ts:window:notifyRendererReadyhandler +appWindow.notifyRendererReady().app.tsx: one-shotuseLayoutEffectsignaling after first commit, unconditional (fires even on the fail-soft null-snapshot path).Not included: removing the
.maka-preloadskeleton (kept as reload-time anti-flash layer);paintWhenInitiallyHiddenuntouched (visual-smoke capture depends on it).Verification
npm run typecheck,npm run -w @maka/desktop test(2151 pass / 0 fail, +8 new),npm run build— all green.isVisible()flipping only after the skeleton is gone and the real app frame is mounted; reveal is ~140ms later than the old show-immediately behavior.User-facing impact
Launch no longer flashes a skeleton card; the window appears already rendered. No changelog entry needed (unreleased).
Reviewer notes
document.visibilityStateis misleading for verifying this:paintWhenInitiallyHiddenmakes hidden windows paint, so it flips before the window is actually on screen — hence the main-processisVisible()verification. Review focus: thekeepHiddenForVisualSmokepredicate must exactly mirror the old creation-time!app.isPackaged && startHiddengate.