Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Bot panel: keep search when the only other conversation has ended

luishron12374f6b80ff514
diff --git a/src/components/bot-panel/Conversations.dom.test.ts b/src/components/bot-panel/Conversations.dom.test.ts
index 8335053d88..65a35d76b3 100644
--- a/src/components/bot-panel/Conversations.dom.test.ts
+++ b/src/components/bot-panel/Conversations.dom.test.ts
@@ -388,4 +388,15 @@ describe("a bot's conversations in its panel", () => {
expect(listed()).toEqual(["deck"]);
expect(host.querySelector("[data-conversations-ended]")).toBeNull();
});
+
+ it("keeps search when the only other conversation has ended, and finds it", () => {
+ const lead = { botId: "lead", name: "Lead", at: now };
+ render(research({ tasks: [task("who", "Who am I?", 2), task("deck", "Summarise the board deck", 4, { closedBy: lead })] }));
+ expect(listed()).toEqual(["who"]);
+ expect(host.querySelector("[data-conversations-ended]")!.textContent).toBe("Ended (1)");
+ click(host.querySelector("[data-conversations-search]"));
+ type(host.querySelector<HTMLInputElement>("[data-conversations-query]")!, "board");
+ expect(listed()).toEqual(["deck"]);
+ });
});
+
diff --git a/src/components/bot-panel/Conversations.tsx b/src/components/bot-panel/Conversations.tsx
index 776561d01f..888426dd3e 100644
--- a/src/components/bot-panel/Conversations.tsx
+++ b/src/components/bot-panel/Conversations.tsx
@@ -136,9 +136,9 @@ export function BotConversations({ bot }: { bot: Bot }) {
setSearching(false);
};
- // An open search stays up even if archiving leaves one conversation, so it can still be cleared.
- // An archived open conversation stays listed too, so it is not hidden while it is open.
- const listed = conversations.length >= 2 || searching || conversations.some((task) => task.threadId === bot.threadId && isArchived(task));
+ // Ended conversations count, since search finds them. An open search stays up even if archiving leaves one
+ // conversation, so it can still be cleared. An archived open conversation stays listed too, so it is not hidden while it is open.
+ const listed = conversations.length + ended.length >= 2 || searching || conversations.some((task) => task.threadId === bot.threadId && isArchived(task));
const row = (task: (typeof threads)[number]) => (
<div role="listitem" key={task.threadId} data-conversation={task.threadId}>
<SidebarThreadRow panel preview={preview(task.threadId)} task={task} ownerId={bot.id} current={task.threadId === bot.threadId}