Skip to content
TypeScript

fix(web): Reconnect on a switched-off environment switches it back on (#24691)

Jackson Millere5871b671963
diff --git a/apps/web/src/components/chat/useSystemComposerBanners.tsx b/apps/web/src/components/chat/useSystemComposerBanners.tsx
index 28b0899fc80..1d29dfcb19e 100644
--- a/apps/web/src/components/chat/useSystemComposerBanners.tsx
+++ b/apps/web/src/components/chat/useSystemComposerBanners.tsx
@@ -84,7 +84,11 @@ export function useSystemComposerBanners(input: SystemComposerBannersInput) {
ENVIRONMENT_RECONNECT_WARNING_GRACE_MS,
);
const handleReconnectActiveEnvironment = async (environmentId: EnvironmentId) => {
- const result = await retryEnvironment(environmentId);
+ // A retry does nothing while the environment is switched off.
+ const result =
+ activeEnvironment?.entry.enabled === false
+ ? await setEnvironmentEnabled({ environmentId, enabled: true })
+ : await retryEnvironment(environmentId);
if (result._tag === "Failure" && !isAtomCommandInterrupted(result)) {
const error = squashAtomCommandFailure(result);
toastManager.add(