Context
The first-run welcome flow (PR #84) has a race that prevents the selected port from being persisted on the first explicit Continue click. Subsequent launches therefore show the welcome screen again instead of auto-starting on the saved port.
Current behavior
- User clicks Continue on the welcome screen.
- Renderer awaits
controller.startServer(port).
- Main process runs
startProductionServer, then await openMainAppWindow(url), which calls loadURL on the welcome window (navigating it to the main app).
- Main process returns the IPC reply.
- Renderer's continuation runs
writeSavedPort(result.port) then navigateToApp(result.url).
By step 5, the welcome page is being torn down by loadURL from step 3. The continuation may never run, and even if it does, the localStorage write is racing the page teardown. The selected port is not reliably saved.
Expected behavior
The port is persisted before any navigation happens, so the next launch can auto-start on it.
Proposed fix
Move persistence into the main process. After startProductionServer succeeds, write the port to app.getPath('userData')/controller.json. Expose it to the renderer via a new controller.getSavedPort() IPC method (replacing localStorage.controller.port). The main process owns persistence from then on; the renderer reads through IPC.
This is a small, well-scoped change but touches the welcome script, the preload, the main process, and shared/controller.ts. Worth a follow-up PR rather than a last-minute addition to #84.
Workaround
Until this is fixed, the auto-start on second launch only works if the user didn't go through the explicit Continue path on first run (e.g. if the saved port was already populated by a previous, separate run). In practice, first-time users will see the welcome screen every launch.
Context
The first-run welcome flow (PR #84) has a race that prevents the selected port from being persisted on the first explicit Continue click. Subsequent launches therefore show the welcome screen again instead of auto-starting on the saved port.
Current behavior
controller.startServer(port).startProductionServer, thenawait openMainAppWindow(url), which callsloadURLon the welcome window (navigating it to the main app).writeSavedPort(result.port)thennavigateToApp(result.url).By step 5, the welcome page is being torn down by
loadURLfrom step 3. The continuation may never run, and even if it does, thelocalStoragewrite is racing the page teardown. The selected port is not reliably saved.Expected behavior
The port is persisted before any navigation happens, so the next launch can auto-start on it.
Proposed fix
Move persistence into the main process. After
startProductionServersucceeds, write the port toapp.getPath('userData')/controller.json. Expose it to the renderer via a newcontroller.getSavedPort()IPC method (replacinglocalStorage.controller.port). The main process owns persistence from then on; the renderer reads through IPC.This is a small, well-scoped change but touches the welcome script, the preload, the main process, and
shared/controller.ts. Worth a follow-up PR rather than a last-minute addition to #84.Workaround
Until this is fixed, the auto-start on second launch only works if the user didn't go through the explicit Continue path on first run (e.g. if the saved port was already populated by a previous, separate run). In practice, first-time users will see the welcome screen every launch.