Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): disconnect offline servers from threads #11671

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/11671/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 3 changed files with 147 additions and 35 deletions (loading 1).

x
0 of 3 viewed, 3 left
82 additions and 35 deletionsapps/web/src/components/ChatView.tsxModified
View file
@@ -308,6 +308,8 @@
} from "../lib/composerContextRecords";
import { type ReviewCommentContext } from "../reviewCommentContext";
import { environmentCatalog } from "../connection/catalog";
+import { isDesktopLocalConnectionTarget } from "../connection/desktopLocal";
+import { useEnvironmentDisconnectDelay } from "../hooks/useEnvironmentDisconnectDelay";
import { selectThreadTerminalUiState, useTerminalUiStateStore } from "../terminalUiStateStore";
import { useKnownTerminalSessions, useThreadRunningTerminalIds } from "../state/terminalSessions";
import { useEnvironmentQuery } from "../state/query";
@@ -1497,6 +1499,9 @@
const { environments } = useEnvironments();
const primaryEnvironment = usePrimaryEnvironment();
const retryEnvironment = useAtomCommand(environmentCatalog.retryNow, { reportFailure: false });
+ const setEnvironmentEnabled = useAtomCommand(environmentCatalog.setEnabled, {
+ reportFailure: false,
+ });
const environmentById = useMemo(
() => new Map(environments.map((environment) => [environment.environmentId, environment])),
[environments],
@@ -2208,6 +2213,37 @@
[retryEnvironment],
+ const disconnectDelayElapsed = useEnvironmentDisconnectDelay(
+ activeEnvironmentUnavailable ? activeEnvironment.environmentId : null,
+ );
+ const canDisconnectActiveEnvironment =
+ disconnectDelayElapsed &&