The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 11:00 UTC
fix(mobile): environment filter leaves out switched-off environments (#32946)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Tom Moses committed
Nov 15, 2026 at 18:51 UTC
26b63a44f9ea44297af45174dea0b133ad6730b2
4 files changed
+58
-23
apps/mobile/src/features/home/HomeRouteScreen.tsx
+2
-16
@@ -2,8 +2,6 @@ import { uuidv4 } from "../../lib/uuid";
2
import { ThreadUndoNotice } from "./ThreadUndoNotice";
3
import { use } from "react";
4
import { NativePrimaryColumnContext } from "../../native/v5-workspace-context";
5
-import * as Arr from "effect/Array";
6
-import * as Order from "effect/Order";
5
import { useNavigation } from "@react-navigation/native";
6
import { useMemo, useState } from "react";
7
import { Platform } from "react-native";
@@ -41,7 +39,7 @@ import { useSelectWorkspaceTab } from "../layout/workspace/useSelectWorkspaceTab
39
import { useSelectWorkspaceDetail } from "../layout/workspace/useSelectWorkspaceDetail";
40
import { WorkspaceListEmptyDetail } from "../layout/workspace/WorkspaceListEmptyDetail";
41
import { WorkspaceListHeader } from "../layout/workspace/WorkspaceListHeader";
44
-import { buildHomeListFilterMenuItems } from "./home-list-filter-menu";
42
+import { buildHomeListFilterMenuItems, homeListFilterEnvironments } from "./home-list-filter-menu";
43
44
export function HomeRouteScreen() {
45
const nativePrimaryColumn = use(NativePrimaryColumnContext);
@@ -108,19 +106,7 @@ export function HomeRouteScreen() {
106
const pendingTasks = usePendingNewTasks();
107
const { openPendingTask, confirmDeletePendingTask } =
108
usePendingTaskListActions(selectThreadRoute);
111
- const connectionStateByEnvironmentId = new Map(
112
- workspaceEnvironments.map(
113
- (environment) => [environment.environmentId, environment.connectionState] as const,
114
- ),
115
- );
116
- const environments = Arr.sort(
117
- Object.values(savedConnectionsById).map((connection) => ({
118
- environmentId: connection.environmentId,
119
- label: connection.environmentLabel,
120
- connectionState: connectionStateByEnvironmentId.get(connection.environmentId) ?? "available",
121
- })),
122
- Order.mapInput(Order.String, (environment: { readonly label: string }) => environment.label),
123
- );
109
+ const environments = homeListFilterEnvironments(workspaceEnvironments);
110
const availableEnvironmentIds = useMemo(
111
() => new Set(environments.map((environment) => environment.environmentId)),
112
[environments],
apps/mobile/src/features/home/home-list-filter-menu.test.ts
new
+35
@@ -0,0 +1,35 @@
1
+import type { EnvironmentId } from "@t3tools/contracts";
2
+import { expect, it } from "vite-plus/test";
3
+
4
+import type { WorkspaceEnvironment } from "../../state/workspaceModel";
5
+import { homeListFilterEnvironments } from "./home-list-filter-menu";
6
+
7
+function environment(
8
+ environmentId: string,
9
+ environmentLabel: string,
10
+ isEnabled: boolean,
11
+): WorkspaceEnvironment {
12
+ return {
13
+ environmentId: environmentId as EnvironmentId,
14
+ environmentLabel,
15
+ displayUrl: "",
16
+ isRelayManaged: false,
17
+ isEnabled,
18
+ connectionState: isEnabled ? "connected" : "available",
19
+ connectionError: null,
20
+ connectionErrorTraceId: null,
21
+ };
22
+}
23
+
24
+it("offers only switched-on environments, sorted by label", () => {
25
+ expect(
26
+ homeListFilterEnvironments([
27
+ environment("env-studio", "Studio", true),
28
+ environment("env-laptop", "Laptop", false),
29
+ environment("env-desk", "Desk", true),
30
+ ]),
31
+ ).toEqual([
32
+ { environmentId: "env-desk", label: "Desk", connectionState: "connected" },
33
+ { environmentId: "env-studio", label: "Studio", connectionState: "connected" },
34
+ ]);
35
+});
apps/mobile/src/features/home/home-list-filter-menu.ts
+16
@@ -1,12 +1,28 @@
1
import type { EnvironmentId } from "@t3tools/contracts";
2
+import * as Arr from "effect/Array";
3
+import * as Order from "effect/Order";
4
5
import type { AppBarMenuItem } from "../../components/ui/AppBar.types";
6
+import type { WorkspaceEnvironment } from "../../state/workspaceModel";
7
8
export interface HomeListFilterMenuEnvironment {
9
readonly environmentId: EnvironmentId;
10
readonly label: string;
11
}
12
13
+export function homeListFilterEnvironments(environments: ReadonlyArray<WorkspaceEnvironment>) {
14
+ return Arr.sort(
15
+ environments
16
+ .filter((environment) => environment.isEnabled)
17
+ .map((environment) => ({
18
+ environmentId: environment.environmentId,
19
+ label: environment.environmentLabel,
20
+ connectionState: environment.connectionState,
21
+ })),
22
+ Order.mapInput(Order.String, (environment: { readonly label: string }) => environment.label),
23
+ );
24
+}
25
+
26
export interface HomeListFilterMenuProject {
27
readonly key: string;
28
readonly label: string;
apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
+5
-7
@@ -44,7 +44,10 @@ import { useThreadJumpShortcuts } from "../keyboard/threadKeyboardShortcuts";
44
import { requestThreadMessageJump } from "./threadMessageJump";
45
import { useThreadListSearchMatches } from "./useThreadListSearchMatches";
46
import { useHomeListOptions } from "../home/home-list-options";
47
-import { buildHomeListFilterMenuItems } from "../home/home-list-filter-menu";
47
+import {
48
+ buildHomeListFilterMenuItems,
49
+ homeListFilterEnvironments,
50
+} from "../home/home-list-filter-menu";
51
import {
52
buildHomeProjectScopes,
53
resolveHomeProjectFilterScope,
@@ -150,12 +153,7 @@ function ThreadNavigationSidebarPane(props: ThreadNavigationSidebarProps) {
153
const { confirmDeletePendingTask } = usePendingTaskListActions((params) =>
154
selectDetail({ name: "Thread", params }),
155
);
153
- const environments = Object.values(savedConnectionsById)
154
- .map((connection) => ({
155
- environmentId: connection.environmentId,
156
- label: connection.environmentLabel,
157
- }))
158
- .sort((left, right) => left.label.localeCompare(right.label));
156
+ const environments = homeListFilterEnvironments(workspaceEnvironments);
157
const availableEnvironmentIds = new Set(
158
environments.map((environment) => environment.environmentId),
159
);