⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(web): keep task-key matches in global search
Kyle J. Fischer82ffb4d2f3d1
diff --git a/apps/web/src/components/search-command-menu/index.test.tsx b/apps/web/src/components/search-command-menu/index.test.tsxnew file mode 100644index 000000000..a8ac51af6--- /dev/null+++ b/apps/web/src/components/search-command-menu/index.test.tsx@@ -0,0 +1,66 @@+import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it, vi } from "vite-plus/test";+import SearchCommandMenu from "./index";++const searchResults = {+ results: [+ {+ id: "task-12",+ type: "task",+ title: "Collect the weekly report list",+ projectId: "project-1",+ projectSlug: "FF",+ taskNumber: 12,+ },+ {+ id: "task-23",+ type: "task",+ title: "Rewrite the workflow note",+ description: "Mentions FF-12 in passing.",+ projectId: "project-2",+ projectSlug: "PER",+ taskNumber: 23,+ },+ ],+};++vi.mock("react-i18next", () => ({+ useTranslation: () => ({ t: (key: string) => key }),+}));++vi.mock("@tanstack/react-router", () => ({+ useNavigate: () => vi.fn(),+}));++vi.mock("@/hooks/queries/search/use-global-search", () => ({+ default: () => ({ data: searchResults }),+}));++vi.mock("@/hooks/queries/workspace/use-active-workspace", () => ({+ default: () => ({ data: { id: "workspace-1" } }),+}));++vi.mock("@/hooks/use-keyboard-shortcuts", () => ({+ getModifierKeyText: () => "Ctrl",+ useRegisterShortcuts: vi.fn(),+}));++describe("SearchCommandMenu", () => {+ afterEach(() => {+ cleanup();+ });++ it("shows a task found by its key even when its text does not contain the key", async () => {+ render(<SearchCommandMenu open setOpen={vi.fn()} />);++ fireEvent.change(+ screen.getByPlaceholderText("navigation:search.inputPlaceholder"),+ { target: { value: "FF-12" } },+ );++ expect(+ await screen.findByText("Collect the weekly report list"),+ ).toBeInTheDocument();+ expect(screen.getByText("Rewrite the workflow note")).toBeInTheDocument();+ });+});diff --git a/apps/web/src/components/search-command-menu/index.tsx b/apps/web/src/components/search-command-menu/index.tsxindex ed9ce9704..006f7fed2 100644--- a/apps/web/src/components/search-command-menu/index.tsx+++ b/apps/web/src/components/search-command-menu/index.tsx@@ -193,7 +193,7 @@ function SearchCommandMenu({ open, setOpen }: SearchCommandMenuProps) {return (<CommandDialog open={open} onOpenChange={setOpen}><CommandDialogPopup instant>- <Command items={groupedItems}>+ <Command items={groupedItems} filter={null}><CommandInputplaceholder={t("navigation:search.inputPlaceholder")}value={query}