@devries-cameron20 / t3code Mirror · read-only / commits / d4a62da20f
Fork 0

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 23, 01:45 UTC

fix(web): settings project picker lists only the chosen environment's projects (#18503)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

Wes Rollings committed Oct 19, 2026 at 12:39 UTC d4a62da20fda8e79fade94579828f1ce0dcdd66a
3 files changed +67 -2
apps/web/src/components/settings/SettingsScopeSentence.tsx
+2 -1
@@ -33,6 +33,7 @@ import {
33 ALL_PROJECTS_VALUE,
34 environmentAxisValue,
35 projectAxisValue,
36 + projectScopeMenuGroups,
37 selectEnvironmentAxis,
38 selectProjectAxis,
39 settingsScopeEnvironmentAddress,
@@ -287,7 +288,7 @@ function EnvironmentScopeMenu({
288
289 function ProjectScopeMenu({ value, groups, environments, onChange }: SettingsScopeMenuProps) {
290 const selected = groups.find((group) => group.projectKey === value.project);
290 - const projects = groups.map((group) => ({
291 + const projects = projectScopeMenuGroups(groups, value).map((group) => ({
292 group,
293 machines: settingsScopeProjectMachines(group, environments, true).join(", "),
294 }));
apps/web/src/components/settings/settingsScopeAxis.test.ts
+54 -1
@@ -1,9 +1,11 @@
1 -import { EnvironmentId } from "@t3tools/contracts";
1 +import { EnvironmentId, ProjectId } from "@t3tools/contracts";
2 import { describe, expect, it } from "vite-plus/test";
3
4 +import type { SidebarProjectSnapshot } from "../../sidebarProjectGrouping";
5 import {
6 environmentAxisValue,
7 projectAxisValue,
8 + projectScopeMenuGroups,
9 selectEnvironmentAxis,
10 selectProjectAxis,
11 settingsScopeEnvironmentLabel,
@@ -83,3 +85,54 @@ describe("environmentAxisValue", () => {
85 expect(environmentAxisValue({ machine: "desk" }, "laptop")).toBe("desk");
86 });
87 });
88 +
89 +describe("settings project picker", () => {
90 + function group(
91 + projectKey: string,
92 + environmentIds: readonly [EnvironmentId, ...EnvironmentId[]],
93 + ): SidebarProjectSnapshot {
94 + const members = environmentIds.map((environmentId) => ({
95 + id: ProjectId.make(`${projectKey}-${environmentId}`),
96 + environmentId,
97 + title: projectKey,
98 + workspaceRoot: `/repos/${projectKey}`,
99 + physicalProjectKey: `${environmentId}:/repos/${projectKey}`,
100 + environmentLabel: null,
101 + defaultModelSelection: null,
102 + scripts: [],
103 + createdAt: "2026-10-19T00:00:00.000Z",
104 + updatedAt: "2026-10-19T00:00:00.000Z",
105 + }));
106 + return {
107 + ...members[0]!,
108 + projectKey,
109 + displayName: projectKey,
110 + memberProjects: members,
111 + memberProjectRefs: members.map((member) => ({
112 + environmentId: member.environmentId,
113 + projectId: member.id,
114 + })),
115 + groupedProjectCount: members.length,
116 + environmentPresence: environmentIds.length > 1 ? "mixed" : "local-only",
117 + allRemoteMembersAreDesktopLocal: false,
118 + allRemoteMembersAreWsl: false,
119 + remoteEnvironmentLabels: [],
120 + };
121 + }
122 +
123 + it("offers groups with any checkout on the chosen environment, or all groups without one", () => {
124 + const laptop = EnvironmentId.make("laptop");
125 + const server = EnvironmentId.make("server");
126 + const local = group("local", [laptop]);
127 + const shared = group("shared", [laptop, server]);
128 + const remote = group("remote", [server]);
129 + const groups = [local, shared, remote];
130 +
131 + expect(projectScopeMenuGroups(groups, { machine: server })).toEqual([shared, remote]);
132 + expect(projectScopeMenuGroups(groups, { machine: laptop })).toEqual([local, shared]);
133 + expect(projectScopeMenuGroups(groups, { machine: "unknown" })).toEqual([]);
134 + expect(projectScopeMenuGroups(groups, {})).toEqual(groups);
135 + expect(projectScopeMenuGroups([], { machine: server })).toEqual([]);
136 + expect(projectScopeMenuGroups([], {})).toEqual([]);
137 + });
138 +});
apps/web/src/components/settings/settingsScopeAxis.ts
+11
@@ -69,6 +69,17 @@ export function projectAxisValue(search: SettingsScopeSearch): string {
69 return search.project ?? ALL_PROJECTS_VALUE;
70 }
71
72 +export function projectScopeMenuGroups(
73 + groups: readonly SidebarProjectSnapshot[],
74 + search: Pick<SettingsScopeSearch, "machine">,
75 +) {
76 + const { machine } = search;
77 + if (machine === undefined) return groups;
78 + return groups.filter((group) =>
79 + group.memberProjects.some((member) => member.environmentId === machine),
80 + );
81 +}
82 +
83 export function selectEnvironmentAxis(
84 search: SettingsScopeSearch,
85 value: string,