Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): search tasks by issue identifier

Dare4c4ccf17e7a4
diff --git a/apps/web/src/hooks/use-task-filters-with-labels-support.test.tsx b/apps/web/src/hooks/use-task-filters-with-labels-support.test.tsx
index c19e5d8e2..327d79d09 100644
--- a/apps/web/src/hooks/use-task-filters-with-labels-support.test.tsx
+++ b/apps/web/src/hooks/use-task-filters-with-labels-support.test.tsx
@@ -103,4 +103,62 @@ describe("useTaskFiltersWithLabelsSupport", () => {
"task-1",
);
});
+
+ it.each(["#123", "proj-123"])(
+ "matches a task by its issue identifier when searching for %s",
+ (textQuery) => {
+ const project = {
+ id: "project-1",
+ name: "Project",
+ slug: "PROJ",
+ icon: null,
+ description: null,
+ isPublic: false,
+ createdAt: "2026-04-16T00:00:00.000Z",
+ updatedAt: "2026-04-16T00:00:00.000Z",
+ workspaceId: "workspace-1",
+ columns: [
+ {
+ id: "todo",
+ slug: "todo",
+ name: "Todo",
+ icon: null,
+ isFinal: false,
+ tasks: [
+ {
+ id: "task-123",
+ title: "Unrelated title",
+ number: 123,
+ description: null,
+ status: "todo",
+ priority: null,
+ startDate: null,
+ dueDate: null,
+ position: 0,
+ createdAt: "2026-04-16T00:00:00.000Z",
+ updatedAt: "2026-04-16T00:00:00.000Z",
+ userId: null,
+ assigneeId: null,
+ assigneeName: null,
+ assigneeImage: null,
+ projectId: "project-1",
+ labels: [],
+ externalLinks: [],
+ },
+ ],
+ },
+ ],
+ plannedTasks: [],
+ archivedTasks: [],
+ };
+
+ const { result } = renderHook(() =>
+ useTaskFiltersWithLabelsSupport(project, "project-1", textQuery),
+ );
+
+ expect(result.current.filteredProject?.columns[0]?.tasks).toEqual([
+ expect.objectContaining({ id: "task-123" }),
+ ]);
+ },
+ );
});
diff --git a/apps/web/src/hooks/use-task-filters-with-labels-support.ts b/apps/web/src/hooks/use-task-filters-with-labels-support.ts
index b6de797ee..4e08cf9fd 100644
--- a/apps/web/src/hooks/use-task-filters-with-labels-support.ts
+++ b/apps/web/src/hooks/use-task-filters-with-labels-support.ts
@@ -79,9 +79,16 @@ export function useTaskFiltersWithLabelsSupport(
if (normalizedTextQuery) {
const title = task.title?.toLowerCase() ?? "";
const description = task.description?.toLowerCase() ?? "";
+ const taskNumber = task.number?.toString() ?? "";
+ const taskIdentifier =
+ `${project?.slug ?? ""}-${taskNumber}`.toLowerCase();
+ const taskShortIdentifier = taskNumber ? `#${taskNumber}` : "";
const matchesText =
title.includes(normalizedTextQuery) ||
- description.includes(normalizedTextQuery);
+ description.includes(normalizedTextQuery) ||
+ taskNumber.includes(normalizedTextQuery) ||
+ taskIdentifier.includes(normalizedTextQuery) ||
+ taskShortIdentifier.includes(normalizedTextQuery);
if (!matchesText) {
return false;
@@ -173,7 +180,7 @@ export function useTaskFiltersWithLabelsSupport(
return true;
});
},
- [filters, textQuery, weekStartsOn],
+ [filters, project?.slug, textQuery, weekStartsOn],
);
const filteredProject = useMemo(() => {