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, 07:15 UTC
fix(web): No project folder follows the app language (#38649)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Wout Stiens committed
Nov 19, 2026 at 03:35 UTC
6ea01d4cbecb37ec59476aa5c87945b9fce61fad
3 files changed
+125
-22
apps/web/src/hooks/useSidebarProjectGroups.ts
+13
-7
@@ -1,3 +1,5 @@
1
+import { useMessages } from "gt-react";
2
+
3
import { orderItemsByPreferredIds, sortSidebarV2ProjectGroups } from "../components/Sidebar.logic";
4
import {
5
getProjectOrderKey,
@@ -20,6 +22,7 @@ export function useSidebarProjectGroups() {
22
const groupingSettings = useClientSettings(selectProjectGroupingSettings);
23
const environments = useEnvironmentIdentities();
24
const primaryEnvironmentId = usePrimaryEnvironmentId();
25
+ const resolve = useMessages();
26
const orderedProjects = orderItemsByPreferredIds({
27
items: projects,
28
preferredIds: projectOrder,
@@ -32,12 +35,15 @@ export function useSidebarProjectGroups() {
35
const labels = new Map(
36
environments.map((environment) => [environment.environmentId, environment.label] as const),
37
);
35
- const unsortedGroups = buildSidebarProjectSnapshots({
36
- projects: sortOrder === "manual" ? orderedProjects : projects,
37
- groupScratchProjects: true,
38
- settings: groupingSettings,
39
- primaryEnvironmentId,
40
- resolveEnvironmentLabel: (environmentId) => labels.get(environmentId) ?? null,
41
- });
38
+ const unsortedGroups = buildSidebarProjectSnapshots(
39
+ {
40
+ projects: sortOrder === "manual" ? orderedProjects : projects,
41
+ groupScratchProjects: true,
42
+ settings: groupingSettings,
43
+ primaryEnvironmentId,
44
+ resolveEnvironmentLabel: (environmentId) => labels.get(environmentId) ?? null,
45
+ },
46
+ resolve,
47
+ );
48
return sortSidebarV2ProjectGroups(unsortedGroups, threads, sortOrder, delegatedUnderParent);
49
}
apps/web/src/sidebarProjectGrouping.ts
+22
-15
@@ -11,6 +11,7 @@ import {
11
} from "@t3tools/client-runtime/state/project-grouping";
12
import { msg } from "gt-react";
13
14
+import { m, type MessageResolver } from "./i18n/messages";
15
import type { Project } from "./types";
16
17
export const PROJECT_GROUPING_MODE_LABELS: Record<SidebarProjectGroupingMode, string> = {
@@ -139,21 +140,27 @@ export function buildPhysicalToLogicalProjectKeyMap(input: {
140
return mapping;
141
}
142
142
-export function buildSidebarProjectSnapshots(input: {
143
- projects: ReadonlyArray<Project>;
144
- settings: ProjectGroupingSettings;
145
- groupScratchProjects?: boolean;
146
- primaryEnvironmentId: EnvironmentId | null;
147
- resolveEnvironmentLabel: (environmentId: EnvironmentId) => string | null;
148
- isDesktopLocalEnvironment?: (environmentId: EnvironmentId) => boolean;
149
- isWslEnvironment?: (environmentId: EnvironmentId) => boolean;
150
-}): SidebarProjectSnapshot[] {
151
- return buildProjectGroups({
152
- projects: input.projects,
153
- groupScratchProjects: input.groupScratchProjects ?? false,
154
- settings: input.settings,
155
- preferredEnvironmentId: input.primaryEnvironmentId,
156
- }).map((group): SidebarProjectSnapshot => {
143
+export function buildSidebarProjectSnapshots(
144
+ input: {
145
+ projects: ReadonlyArray<Project>;
146
+ settings: ProjectGroupingSettings;
147
+ groupScratchProjects?: boolean;
148
+ primaryEnvironmentId: EnvironmentId | null;
149
+ resolveEnvironmentLabel: (environmentId: EnvironmentId) => string | null;
150
+ isDesktopLocalEnvironment?: (environmentId: EnvironmentId) => boolean;
151
+ isWslEnvironment?: (environmentId: EnvironmentId) => boolean;
152
+ },
153
+ resolve: MessageResolver = m,
154
+): SidebarProjectSnapshot[] {
155
+ return buildProjectGroups(
156
+ {
157
+ projects: input.projects,
158
+ groupScratchProjects: input.groupScratchProjects ?? false,
159
+ settings: input.settings,
160
+ preferredEnvironmentId: input.primaryEnvironmentId,
161
+ },
162
+ resolve,
163
+ ).map((group): SidebarProjectSnapshot => {
164
const members = group.members.map(
165
({ physicalProjectKey, project }): SidebarProjectGroupMember => ({
166
...project,
scripts/scenarios/scratch-folder-follows-language.e2e.ts
new
+90
@@ -0,0 +1,90 @@
1
+/// <reference lib="dom" />
2
+import { expect } from "e2e";
3
+
4
+import { test, WEB } from "./t3.ts";
5
+
6
+test(
7
+ "The project folder for threads without a project follows the app language",
8
+ WEB,
9
+ async ({ t3, app, browser, screen }) => {
10
+ const project = await t3.project("scenario-scratch");
11
+ const thread = await t3.thread({ project, title: "Scratch work", messages: ["Start"] });
12
+
13
+ // The scenario home is inside a Git checkout, where the server disables native scratch.
14
+ // Advertise the seeded workspace as scratch while leaving the real project and thread in place.
15
+ await browser.addInitScript((scratchWorkspaceRoot) => {
16
+ const configRequests = new WeakMap<WebSocket, string>();
17
+ const send = WebSocket.prototype.send;
18
+ WebSocket.prototype.send = function (data) {
19
+ if (typeof data === "string") {
20
+ for (const request of [JSON.parse(data)].flat()) {
21
+ if (request?._tag === "Request" && request.tag === "subscribeServerConfig") {
22
+ configRequests.set(this, String(request.id));
23
+ }
24
+ }
25
+ }
26
+ return send.call(this, data);
27
+ };
28
+ const addEventListener = WebSocket.prototype.addEventListener;
29
+ WebSocket.prototype.addEventListener = function (
30
+ this: WebSocket,
31
+ type: string,
32
+ listener: EventListenerOrEventListenerObject,
33
+ options?: boolean | AddEventListenerOptions,
34
+ ) {
35
+ if (type !== "message" || typeof listener !== "function") {
36
+ return addEventListener.call(this, type, listener, options);
37
+ }
38
+ return addEventListener.call(
39
+ this,
40
+ type,
41
+ (event: Event) => {
42
+ const data = (event as MessageEvent).data;
43
+ if (typeof data !== "string") return listener.call(this, event);
44
+ const parsed = JSON.parse(data);
45
+ let changed = false;
46
+ for (const message of [parsed].flat()) {
47
+ if (
48
+ message?._tag !== "Chunk" ||
49
+ String(message.requestId) !== configRequests.get(this)
50
+ )
51
+ continue;
52
+ for (const value of message.values) {
53
+ if (value.type === "snapshot") {
54
+ value.config.scratchWorkspaceRoot = scratchWorkspaceRoot;
55
+ changed = true;
56
+ }
57
+ }
58
+ }
59
+ return listener.call(
60
+ this,
61
+ changed ? new MessageEvent("message", { data: JSON.stringify(parsed) }) : event,
62
+ );
63
+ },
64
+ options,
65
+ );
66
+ } as typeof WebSocket.prototype.addEventListener;
67
+ }, project);
68
+
69
+ await t3.open("/settings/labs");
70
+ await screen.getByLabel("Boring sidebar (group by project)", { exact: true }).tap();
71
+ await screen.getByLabel("Two-line folder rows", { exact: true }).waitFor();
72
+
73
+ await t3.open("/settings/general");
74
+ const openFolder = screen.getByTestId("sidebar-project-folder");
75
+ await expect(openFolder).toContainText("No project", { timeout: 60_000 });
76
+ await screen.getByLabel("Language", { exact: true }).tap();
77
+ await screen.getByText("日本語", { exact: true }).tap();
78
+ await screen.getByLabel("言語", { exact: true }).waitFor();
79
+ // Settings leaves the sidebar mounted. Keep this failure through the capture after reopening.
80
+ await expect.soft(openFolder).toContainText("プロジェクトなし");
81
+
82
+ await t3.open(thread);
83
+ const folder = screen.getByTestId("sidebar-project-folder");
84
+ await folder.getByText(/^(?:No project|プロジェクトなし)$/, { exact: true }).waitFor({
85
+ timeout: 60_000,
86
+ });
87
+ await app.screenshot("scratch-folder-in-japanese");
88
+ await expect(folder).toContainText("プロジェクトなし");
89
+ },
90
+);