diff --git a/ui/src/components/IssueProperties.test.tsx b/ui/src/components/IssueProperties.test.tsx index ec0ec658b6c..63f8d1eb138 100644 --- a/ui/src/components/IssueProperties.test.tsx +++ b/ui/src/components/IssueProperties.test.tsx @@ -460,6 +460,53 @@ describe("IssueProperties", () => { act(() => root.unmount()); }); + it("filters the no-assignee option with assignee search", async () => { + mockAgentsApi.list.mockResolvedValue([ + { + id: "agent-1", + name: "ClaudeCoder", + role: "", + title: null, + icon: null, + status: "active", + orgChainHealth: { status: "ok" }, + } as unknown as Parameters[0][number], + ]); + const root = renderProperties(container, { + issue: createIssue(), + childIssues: [], + onUpdate: vi.fn(), + }); + await flush(); + + const searchInput = container.querySelector( + 'input[placeholder="Search assignees..."]', + ) as HTMLInputElement | null; + expect(searchInput).not.toBeNull(); + + await act(async () => { + const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set; + nativeSetter?.call(searchInput, "no"); + searchInput!.dispatchEvent(new Event("input", { bubbles: true })); + }); + await flush(); + + expect(container.textContent).toContain("No assignee"); + expect(container.textContent).not.toContain("No matches."); + + await act(async () => { + const nativeSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set; + nativeSetter?.call(searchInput, "zzzz"); + searchInput!.dispatchEvent(new Event("input", { bubbles: true })); + }); + await flush(); + + expect(container.textContent).not.toContain("No assignee"); + expect(container.textContent).toContain("No matches."); + + act(() => root.unmount()); + }); + it("always exposes the add sub-issue action", async () => { const onAddSubIssue = vi.fn(); const root = renderProperties(container, { diff --git a/ui/src/components/IssueProperties.tsx b/ui/src/components/IssueProperties.tsx index b730bd83ce7..a3d419255b6 100644 --- a/ui/src/components/IssueProperties.tsx +++ b/ui/src/components/IssueProperties.tsx @@ -1431,6 +1431,7 @@ export function IssueProperties({ const visibleAgentOptions = agentAssigneeOptions.filter((option) => matchesAssigneeSearch(option.label, option.searchText), ); + const showNoAssigneeOption = matchesAssigneeSearch("No assignee", ""); const sectionHeader = (text: string) => (
{text} @@ -1467,7 +1468,9 @@ export function IssueProperties({ autoFocus={!inline} />
- {renderAssigneeOption({ kind: "none", value: "", label: "No assignee", searchText: "" })} + {showNoAssigneeOption + ? renderAssigneeOption({ kind: "none", value: "", label: "No assignee", searchText: "" }) + : null} {visibleAgentOptions.length > 0 ? ( <> {sectionHeader("Agents")} @@ -1480,7 +1483,7 @@ export function IssueProperties({ {visibleUserOptions.map((option) => renderAssigneeOption(option))} ) : null} - {visibleAgentOptions.length === 0 && visibleUserOptions.length === 0 ? ( + {!showNoAssigneeOption && visibleAgentOptions.length === 0 && visibleUserOptions.length === 0 ? (
No matches.
) : null}