From 4506e73863d421f620be03a298d98d4dbe9ddb02 Mon Sep 17 00:00:00 2001 From: Josh Gratton Date: Mon, 11 May 2026 11:44:52 -0400 Subject: [PATCH] fix(desktop): treat re-pick of resolved-default distro as a no-op The dropdown maps state.distro: null to the actual default distro's name so the Select highlights a real option, but the no-op check still compared target.distro (e.g. "Ubuntu") against state.distro (null). Re-picking the visually-active row opened the confirmation dialog and triggered a full backend restart for what was clearly a no-op. Resolve both sides through the same null->default mapping before comparing. --- .../src/components/settings/ConnectionsSettings.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/settings/ConnectionsSettings.tsx b/apps/web/src/components/settings/ConnectionsSettings.tsx index fccc2e68c3..b84e291153 100644 --- a/apps/web/src/components/settings/ConnectionsSettings.tsx +++ b/apps/web/src/components/settings/ConnectionsSettings.tsx @@ -2374,7 +2374,18 @@ export function ConnectionsSettings() { mode: "wsl" as const, distro: value === BACKEND_VALUE_DEFAULT_WSL ? null : value, }; - if (target.mode === desktopWslState.mode && target.distro === desktopWslState.distro) { + // The dropdown maps `state.distro: null` to the actual default distro + // name so a real option highlights — re-picking the visually-active row + // produces `target.distro = ""` while state is still + // `null`. Resolve both sides through the same null→default mapping + // before comparing so this is a true no-op. + const defaultDistroName = + desktopWslState.distros.find((distro) => distro.isDefault)?.name ?? null; + const resolvedCurrentDistro = + desktopWslState.mode === "wsl" ? (desktopWslState.distro ?? defaultDistroName) : null; + const resolvedTargetDistro = + target.mode === "wsl" ? (target.distro ?? defaultDistroName) : null; + if (target.mode === desktopWslState.mode && resolvedTargetDistro === resolvedCurrentDistro) { return; } setPendingDesktopWslSelection(target);