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 22, 09:30 UTC
fix(web): restore No project name and icon from settings (#26798)
Co-authored-by: PR Batch Tester <agent@local.test> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
shivam committed
Oct 31, 2026 at 14:16 UTC
7671644754e9a3d231c8e119c434bea6b8cc8b15
3 files changed
+120
-15
apps/web/src/components/settings/ProjectSettingsPanel.browser.test.tsx
+55
@@ -457,6 +457,61 @@ describe("project settings permissions", () => {
457
);
458
});
459
460
+describe("project identity reset", () => {
461
+ const scratchIcon = { kind: "lucide", name: "message-square-dashed", color: "gray" } as const;
462
+ const resetButton = (screen: Screen, label: string) =>
463
+ screen.container.querySelector<HTMLButtonElement>(`[aria-label="Reset ${label} to default"]`);
464
+ const asScratch = (project: Project): Project => ({
465
+ ...project,
466
+ isScratch: true,
467
+ title: "Notes",
468
+ workspaceRoot: "/t3/scratch",
469
+ projectIcon: { kind: "emoji", emoji: "📝" },
470
+ });
471
+
472
+ it("restores a renamed scratch project's built-in name and icon", async () => {
473
+ setup();
474
+ state.projects = [{ ...asScratch(state.projects[0]!), faviconPath: null, projectIcon: null }];
475
+ await using screen = await mountPanel();
476
+
477
+ await userEvent.click(resetButton(screen, "project name")!);
478
+ await vi.waitFor(() =>
479
+ expect(state.update).toHaveBeenCalledWith({
480
+ environmentId: primaryId,
481
+ input: { projectId: state.projects[0]!.id, title: "No project" },
482
+ }),
483
+ );
484
+ await userEvent.click(resetButton(screen, "project icon")!);
485
+ await vi.waitFor(() =>
486
+ expect(state.update).toHaveBeenLastCalledWith({
487
+ environmentId: primaryId,
488
+ input: { projectId: state.projects[0]!.id, faviconPath: null, projectIcon: scratchIcon },
489
+ }),
490
+ );
491
+ });
492
+
493
+ it("resets each member of a mixed group to its own default icon", async () => {
494
+ setup();
495
+ const [primary, remote] = state.projects;
496
+ state.projects = [asScratch(primary!), { ...remote!, faviconPath: "logo.png" }];
497
+ await using screen = await mountPanel();
498
+
499
+ expect(resetButton(screen, "project name")).toBeNull();
500
+ await userEvent.click(resetButton(screen, "project icon")!);
501
+ await vi.waitFor(() => expect(state.update).toHaveBeenCalledTimes(2));
502
+ expect(state.update.mock.calls.map(([request]) => request)).toEqual([
503
+ {
504
+ environmentId: primaryId,
505
+ input: { projectId: primary!.id, faviconPath: null, projectIcon: scratchIcon },
506
+ },
507
+ {
508
+ environmentId: remoteId,
509
+ input: { projectId: remote!.id, faviconPath: null, projectIcon: null },
510
+ },
511
+ ]);
512
+ });
513
+});
514
+
515
describe("project settings scope", () => {
516
const environmentMenu = () => page.getByRole("button", { name: /^Environment scope:/ });
517
const primaryOption = () => page.getByRole("menuitemradio", { name: /^primary/ });
apps/web/src/components/settings/ProjectSettingsPanel.logic.ts
+28
@@ -1,3 +1,14 @@
1
+import type { ProjectIconOverride } from "@t3tools/contracts";
2
+
3
+import type { Project } from "../../types";
4
+
5
+export const SCRATCH_PROJECT_TITLE = "No project";
6
+const SCRATCH_PROJECT_ICON = {
7
+ kind: "lucide",
8
+ name: "message-square-dashed",
9
+ color: "gray",
10
+} as const satisfies ProjectIconOverride;
11
+
12
export function projectGroupTitleNeedsUpdate(
13
memberTitles: ReadonlyArray<string>,
14
nextTitle: string,
@@ -5,3 +16,20 @@ export function projectGroupTitleNeedsUpdate(
16
): boolean {
17
return wasEdited && memberTitles.some((title) => title !== nextTitle);
18
}
19
+
20
+export function defaultProjectIcon(project: Pick<Project, "isScratch">) {
21
+ return { faviconPath: null, projectIcon: project.isScratch ? SCRATCH_PROJECT_ICON : null };
22
+}
23
+
24
+export function hasDefaultProjectIcon(
25
+ project: Pick<Project, "isScratch" | "faviconPath" | "projectIcon">,
26
+): boolean {
27
+ if (project.faviconPath != null) return false;
28
+ const icon = project.projectIcon ?? null;
29
+ if (!project.isScratch) return icon === null;
30
+ return (
31
+ icon?.kind === "lucide" &&
32
+ icon.name === SCRATCH_PROJECT_ICON.name &&
33
+ icon.color === SCRATCH_PROJECT_ICON.color
34
+ );
35
+}
apps/web/src/components/settings/ProjectSettingsPanel.tsx
+37
-15
@@ -46,7 +46,12 @@ import {
46
} from "./ProjectFaviconPickerDialog";
47
import { ProjectActionsSettings } from "./ProjectActionsSettings";
48
import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings";
49
-import { projectGroupTitleNeedsUpdate } from "./ProjectSettingsPanel.logic";
49
+import {
50
+ defaultProjectIcon,
51
+ hasDefaultProjectIcon,
52
+ projectGroupTitleNeedsUpdate,
53
+ SCRATCH_PROJECT_TITLE,
54
+} from "./ProjectSettingsPanel.logic";
55
import { useSettingsProjectGroups } from "./useSettingsProjectGroups";
56
import { readUnloadedThreadCount } from "../../state/olderSettledShelf";
57
import { settingsScopeEnvironmentLabels } from "./settingsScopeAxis";
@@ -169,6 +174,12 @@ export function ProjectSettingsPanel({
174
);
175
}
176
177
+type ProjectIdentityUpdate = Partial<{
178
+ title: string;
179
+ faviconPath: string | null;
180
+ projectIcon: ProjectIconOverride | null;
181
+}>;
182
+
183
function ProjectDetail({
184
group,
185
hasOtherMembers,
@@ -243,11 +254,7 @@ function ProjectDetail({
254
};
255
256
const updateAllMembers = async (
246
- input: Partial<{
247
- title: string;
248
- faviconPath: string | null;
249
- projectIcon: ProjectIconOverride | null;
250
- }>,
257
+ input: ProjectIdentityUpdate | ((member: SidebarProjectGroupMember) => ProjectIdentityUpdate),
258
failureTitle: string,
259
): Promise<AtomCommandResult<void, unknown>> => {
260
const denied = checkProjectAccess(group.memberProjects, failureTitle);
@@ -270,7 +277,10 @@ function ProjectDetail({
277
const result = mapAtomCommandResult(
278
await updateProject({
279
environmentId: member.environmentId,
273
- input: { projectId: member.id, ...input },
280
+ input: {
281
+ projectId: member.id,
282
+ ...(typeof input === "function" ? input(member) : input),
283
+ },
284
}),
285
() => undefined,
286
);
@@ -309,10 +319,7 @@ function ProjectDetail({
319
const [iconPickerOpen, setIconPickerOpen] = useComposerMenuState(!canEditGroup);
320
const [isSavingFavicon, setIsSavingFavicon] = useState(false);
321
const savingFaviconRef = useRef(false);
312
- const setProjectIcon = async (input: {
313
- faviconPath: string | null;
314
- projectIcon: ProjectIconOverride | null;
315
- }) => {
322
+ const setProjectIcon = async (input: Parameters<typeof updateAllMembers>[0]) => {
323
if (savingFaviconRef.current) return;
324
savingFaviconRef.current = true;
325
setIsSavingFavicon(true);
@@ -322,6 +329,9 @@ function ProjectDetail({
329
};
330
331
const hasMultipleCheckouts = group.memberProjects.length > 1;
332
+ const canResetScratchTitle =
333
+ group.memberProjects.every((member) => member.isScratch) &&
334
+ group.memberProjects.some((member) => member.title !== SCRATCH_PROJECT_TITLE);
335
336
const removeMembers = async (members: ReadonlyArray<SidebarProjectGroupMember>) => {
337
if (checkProjectAccess(members, "Failed to remove project")) return;
@@ -489,6 +499,20 @@ function ProjectDetail({
499
<SettingsRow
500
title="Name"
501
description="The shared name for this project group in the sidebar and thread lists."
502
+ resetAction={
503
+ canResetScratchTitle ? (
504
+ <SettingResetButton
505
+ label="project name"
506
+ disabled={!canEditGroup}
507
+ onClick={() =>
508
+ void updateAllMembers(
509
+ { title: SCRATCH_PROJECT_TITLE },
510
+ "Failed to rename project",
511
+ )
512
+ }
513
+ />
514
+ ) : null
515
+ }
516
control={
517
<Input
518
key={`${group.projectKey}:${group.displayName}`}
@@ -523,13 +547,11 @@ function ProjectDetail({
547
: (faviconPath ?? "Automatic")
548
}
549
resetAction={
526
- group.memberProjects.some(
527
- (member) => member.faviconPath != null || member.projectIcon != null,
528
- ) ? (
550
+ group.memberProjects.some((member) => !hasDefaultProjectIcon(member)) ? (
551
<SettingResetButton
552
label="project icon"
553
disabled={isSavingFavicon || !canEditGroup}
532
- onClick={() => void setProjectIcon({ faviconPath: null, projectIcon: null })}
554
+ onClick={() => void setProjectIcon(defaultProjectIcon)}
555
/>
556
) : null
557
}