From b2af107f91af9c940c99110099dc794201c2fcbb Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 21 Jun 2026 21:34:09 +0000 Subject: [PATCH] fix: cloud switch retry and encrypted catalog availability handling - Fix cloud environment switch showing ON for error/offline states, which blocked retry since React Native Switch only fires onValueChange on transitions. The switch now only shows ON for connected/connecting/ reconnecting states, allowing users to toggle ON to retry from error or offline states. - Fix DesktopConnectionCatalogStore.get returning an empty Option when an encrypted catalog exists but safe storage is unavailable. This silently hid the catalog and risked overwriting it. Now fails with ElectronSafeStorageAvailabilityError so callers can surface the issue instead of treating it as an empty catalog. --- apps/desktop/src/app/DesktopConnectionCatalogStore.ts | 6 +++++- apps/mobile/src/app/settings/environments.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/app/DesktopConnectionCatalogStore.ts b/apps/desktop/src/app/DesktopConnectionCatalogStore.ts index 0b382bb163..5f0b43ba29 100644 --- a/apps/desktop/src/app/DesktopConnectionCatalogStore.ts +++ b/apps/desktop/src/app/DesktopConnectionCatalogStore.ts @@ -300,7 +300,11 @@ export const layer = Layer.effect( return yield* migrateLegacyCatalog; } if (!(yield* safeStorage.isEncryptionAvailable)) { - return Option.none(); + return yield* new ElectronSafeStorage.ElectronSafeStorageAvailabilityError({ + cause: new Error( + "Safe storage encryption is unavailable; cannot decrypt the existing connection catalog", + ), + }); } const decrypted = yield* decodeSecretBytes(document.value.encryptedCatalog).pipe( Effect.flatMap(safeStorage.decryptString), diff --git a/apps/mobile/src/app/settings/environments.tsx b/apps/mobile/src/app/settings/environments.tsx index 93a4194d83..e2ade14cfb 100644 --- a/apps/mobile/src/app/settings/environments.tsx +++ b/apps/mobile/src/app/settings/environments.tsx @@ -255,7 +255,11 @@ function ConnectedCloudEnvironmentRow(props: { props.onDisconnect(); }} onToggleError={props.onToggleError} - value={props.environment.connectionState !== "available"} + value={ + props.environment.connectionState === "connected" || + props.environment.connectionState === "connecting" || + props.environment.connectionState === "reconnecting" + } /> ); }