Skip to content

Commit ae0d45c

Browse files
committed
Roll back persisted WSL config when start fails
Capture the previous on-disk WSL config before persisting the new one, and restore it if startBackend fails. Otherwise the renderer error toast leaves the UI showing the old toggle/distro while the disk has already moved to the never-confirmed configuration, which the next app launch silently honors.
1 parent 7a35f0d commit ae0d45c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

apps/desktop/src/main.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,10 +1983,17 @@ function registerIpcHandlers(): void {
19831983
if (distro !== null && !DISTRO_NAME_PATTERN.test(distro)) {
19841984
return false;
19851985
}
1986+
const previousConfig = loadWslConfig(STATE_DIR);
19861987
saveWslConfig(STATE_DIR, { enabled: typed.enabled, distro });
19871988
await stopBackendAndWaitForExit();
19881989
const started = await startBackend();
19891990
if (!started && typed.enabled) {
1991+
// Roll back so the on-disk config matches the renderer's view; the
1992+
// exponential-backoff restart will relaunch under the previous
1993+
// configuration. Without this, the renderer's error toast leaves the
1994+
// UI showing the old toggle while the next app launch silently honors
1995+
// the never-confirmed configuration.
1996+
saveWslConfig(STATE_DIR, previousConfig);
19901997
throw new Error("Could not start the backend inside WSL.");
19911998
}
19921999
return true;

0 commit comments

Comments
 (0)