Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/web/src/components/CommandPalette.logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ describe("linked pull request thread navigation", () => {
expect(groups.flatMap((group) => group.items)).toEqual(items);
expect(items[0]?.description).toBe("Archived thread");
await items[0]?.run();
expect(runThread).toHaveBeenCalledWith({ environmentId, id });
expect(runThread).toHaveBeenCalledWith({
archivedAt: "2026-09-01T00:00:00.000Z",
environmentId,
id,
});
});
});

Expand Down
25 changes: 21 additions & 4 deletions apps/web/src/components/CommandPalette.logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export function buildLinkedThreadActionItems(
input: CommandPaletteLinkedThreads & {
query: string;
icon: ReactNode;
runThread: (thread: Pick<SidebarThreadSummary, "environmentId" | "id">) => Promise<void>;
runThread: (
thread: Pick<SidebarThreadSummary, "archivedAt" | "environmentId" | "id">,
) => Promise<void>;
},
): CommandPaletteActionItem[] {
return input.threads.map((thread) => ({
Expand All @@ -35,7 +37,12 @@ export function buildLinkedThreadActionItems(
description: thread.archivedAt === null ? "Linked thread" : "Archived thread",
searchTerms: [input.query, thread.title],
icon: input.icon,
run: () => input.runThread({ environmentId: input.environmentId, id: thread.id }),
run: () =>
input.runThread({
archivedAt: thread.archivedAt,
environmentId: input.environmentId,
id: thread.id,
}),
}));
}

Expand Down Expand Up @@ -261,11 +268,18 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
/** Optional rich description (e.g. favicon + workspace icons). Falls back to text. */
renderDescription?: (thread: TThread, meta: { projectTitle: string | undefined }) => ReactNode;
getContentMatch?: (thread: TThread) => CommandPaletteThreadContentMatch | undefined;
runThread: (thread: Pick<SidebarThreadSummary, "environmentId" | "id">) => Promise<void>;
runThread: (
thread: Pick<SidebarThreadSummary, "archivedAt" | "environmentId" | "id">,
) => Promise<void>;
limit?: number;
/** Keep archived threads (search corpora); the default drops them so the
recents list never surfaces archived rows. */
includeArchived?: boolean;
}): CommandPaletteActionItem[] {
const sortedThreads = sortThreads(
input.threads.filter((thread) => thread.archivedAt === null),
input.includeArchived === true
? [...input.threads]
: input.threads.filter((thread) => thread.archivedAt === null),
input.sortOrder,
);
const visibleThreads =
Expand All @@ -284,6 +298,9 @@ export function buildThreadActionItems<TThread extends BuildThreadActionItemsThr
if (thread.id === input.activeThreadId) {
descriptionParts.push("Current thread");
}
if (thread.archivedAt !== null) {
descriptionParts.push("Archived");
}

const leadingContent = input.renderLeadingContent?.(thread);
const trailingContent = input.renderTrailingContent?.(thread);
Expand Down
Loading
Loading