@devries-cameron20 / t3code Mirror · read-only / commits / e6d42567ba
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 22, 02:00 UTC

fix(web): cmd+shift+o picks the current project before pinned ones (#33109)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Theo Browne committed Nov 8, 2026 at 15:31 UTC e6d42567ba927e3ee66c143d7ba810cb22ab4d07
5 files changed +25 -10
apps/web/src/components/CommandPalette.logic.test.ts
+1 -1
@@ -948,7 +948,7 @@ describe("newThreadNoProjectIndex", () => {
948 });
949
950 it("goes after the pinned projects and the first unpinned one", () => {
951 - expect(newThreadNoProjectIndex([entry(true), entry(true), entry(false, true), entry()])).toBe(
951 + expect(newThreadNoProjectIndex([entry(false, true), entry(true), entry(true), entry()])).toBe(
952 3,
953 );
954 expect(newThreadNoProjectIndex([entry(false, true), entry(), entry(false, false, true)])).toBe(
apps/web/src/components/CommandPalette.tsx
+7
@@ -826,8 +826,15 @@ function OpenCommandPaletteDialog(props: {
826 (() => {
827 const isScratch = (project: CommandPaletteProject) =>
828 isScratchProject(project, scratchWorkspaceRootFor(project.environmentId));
829 + const currentEntry =
830 + currentProjectId === null
831 + ? undefined
832 + : projectPickerEntries.find((entry) => entry.isPreferred);
833 const projectItems = buildNewThreadInProjectItems({
834 projects: pickerProjects.filter((project) => !isScratch(project)),
835 + currentProjectKey: currentEntry
836 + ? `${currentEntry.targetProject.environmentId}:${currentEntry.targetProject.id}`
837 + : null,
838 projectGroupByTargetKey,
839 locationByEnvironmentId: projectEnvironmentLocationById,
840 pin: projectPin,
apps/web/src/components/CommandPaletteProjectItems.tsx
+12 -2
@@ -73,7 +73,9 @@ export function buildProjectSearchItems(input: ProjectItemsInput) {
73 }
74
75 /** Projects as targets of the "New thread in..." submenu. */
76 -export function buildNewThreadInProjectItems(input: ProjectItemsInput) {
76 +export function buildNewThreadInProjectItems(
77 + input: ProjectItemsInput & { readonly currentProjectKey: string | null },
78 +) {
79 return buildProjectActionItems({
80 projects: input.projects,
81 valuePrefix: "new-thread-in",
@@ -89,6 +91,7 @@ export function buildNewThreadInProjectItems(input: ProjectItemsInput) {
91 <ProjectLocationDescription
92 location={input.locationByEnvironmentId.get(project.environmentId)}
93 workspaceRoot={project.workspaceRoot}
94 + current={input.currentProjectKey === `${project.environmentId}:${project.id}`}
95 />
96 ),
97 icon: projectFaviconIcon,
@@ -100,10 +103,17 @@ export function buildNewThreadInProjectItems(input: ProjectItemsInput) {
103 function ProjectLocationDescription(props: {
104 readonly location: CommandPaletteProjectLocation | undefined;
105 readonly workspaceRoot: string;
106 + readonly current?: boolean;
107 }) {
108 const location = props.location ?? UNKNOWN_PROJECT_LOCATION;
109 return (
110 <span className="flex min-w-0 items-center gap-1">
111 + {props.current ? (
112 + <>
113 + <span className="shrink-0">Current</span>
114 + <CommandPaletteMetaDot />
115 + </>
116 + ) : null}
117 <span className="inline-flex min-w-0 items-center gap-1">
118 {location.kind === "remote" ? (
119 <EnvironmentMachineIcon
@@ -115,7 +125,7 @@ function ProjectLocationDescription(props: {
125 <span className="truncate">{location.label}</span>
126 </span>
127 <CommandPaletteMetaDot />
118 - <span className="truncate">{props.workspaceRoot}</span>
128 + <span className="min-w-0 flex-1 truncate">{props.workspaceRoot}</span>
129 </span>
130 );
131 }
apps/web/src/environmentGrouping.test.ts
+2 -2
@@ -279,7 +279,7 @@ describe("environment grouping", () => {
279 });
280 });
281
282 - it("puts the preferred project after pinned projects", () => {
282 + it("puts the preferred project before pinned projects", () => {
283 const project = (title: string, pinnedAt: string | null = null) =>
284 makeProject({
285 id: ProjectId.make(title),
@@ -299,6 +299,6 @@ describe("environment grouping", () => {
299 groups: pickableProjectGroups(groups),
300 preferredProjectRef: { environmentId: current.environmentId, projectId: current.id },
301 });
302 - expect(entries.map((entry) => entry.group.displayName)).toEqual(["pinned", "current", "other"]);
302 + expect(entries.map((entry) => entry.group.displayName)).toEqual(["current", "pinned", "other"]);
303 });
304 });
apps/web/src/sidebarProjectGrouping.ts
+3 -5
@@ -239,10 +239,8 @@ export function buildSidebarProjectPickerEntries(input: {
239
240 return [{ group, targetProject, isPreferred }];
241 });
242 - // The preferred project leads the unpinned ones; pinned projects stay first.
242 + // The current project leads, even ahead of pinned projects.
243 const preferred = entries.find((entry) => entry.isPreferred);
244 - if (!preferred || preferred.group.pinned) return entries;
245 - const rest = entries.filter((entry) => entry !== preferred);
246 - const pinnedCount = rest.filter((entry) => entry.group.pinned).length;
247 - return [...rest.slice(0, pinnedCount), preferred, ...rest.slice(pinnedCount)];
244 + if (!preferred) return entries;
245 + return [preferred, ...entries.filter((entry) => entry !== preferred)];
246 }