fix(settings): seed WSL backend state on mount so the WSL settings UI renders
The merge resolution that dropped the old desktop access-management useEffect (now owned by the desktopNetworkAccess hook upstream) also removed the getWslState() initializer it was bundled with. As a result desktopWslState stayed null and renderWslRow() returned null, hiding the WSL settings picker entirely. Re-add a focused effect that seeds desktopWslState from the bridge when local-backend management is available. Addresses Macroscope review finding on ConnectionsSettings.tsx.
This commit is contained in:
1 parent
bb6fafc16a
commit
a10e576422
1 file changed
+28
@@ -2801,6 +2801,34 @@ export function ConnectionsSettings() {
|
||||
[desktopBridge],
|
||||
);
|
||||
|
||||
// Seed the WSL backend state from the desktop bridge on mount (and when
|
||||
// local-backend management becomes available). Without this, desktopWslState
|
||||
// stays null and renderWslRow() bails, hiding the WSL settings UI entirely.
|
||||
// The broader desktop access-management state is owned by desktopNetworkAccess
|
||||
// upstream; this effect only owns the WSL picker's state.
|
||||
useEffect(() => {
|
||||
if (!canManageLocalBackend || !desktopBridge) {
|
||||
return;
|
||||
}
|
||||
let cancelled = false;
|
||||
void desktopBridge
|
||||
.getWslState()
|
||||
.then((state) => {
|
||||
if (!cancelled) {
|
||||
setDesktopWslState(state);
|
||||
}
|
||||
})
|
||||
.catch((error: unknown) => {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
setDesktopWslError(error instanceof Error ? error.message : "Failed to load WSL state.");
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [canManageLocalBackend, desktopBridge]);
|
||||
|
||||
// True when a desktop-local WSL backend is currently registered as an
|
||||
// environment on this machine. We use this as a proxy for "the user has work
|
||||
// that lives on the WSL side": if WSL has connected in a way that registered
|
||||
|
||||
Reference in new issue
Block a user