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): guard nullable task identifiers

Dare1c7366bb658b
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 327d79d09..45170836c 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
@@ -104,7 +104,7 @@ describe("useTaskFiltersWithLabelsSupport", () => {
);
});
- it.each(["#123", "proj-123"])(
+ it.each(["#123", "proj-123", "proj-"])(
"matches a task by its issue identifier when searching for %s",
(textQuery) => {
const project = {
@@ -145,6 +145,26 @@ describe("useTaskFiltersWithLabelsSupport", () => {
labels: [],
externalLinks: [],
},
+ {
+ id: "task-without-number",
+ title: "Another unrelated title",
+ number: null,
+ description: null,
+ status: "todo",
+ priority: null,
+ startDate: null,
+ dueDate: null,
+ position: 1,
+ 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: [],
+ },
],
},
],
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 4e08cf9fd..9c688984a 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
@@ -81,7 +81,9 @@ export function useTaskFiltersWithLabelsSupport(
const description = task.description?.toLowerCase() ?? "";
const taskNumber = task.number?.toString() ?? "";
const taskIdentifier =
- `${project?.slug ?? ""}-${taskNumber}`.toLowerCase();
+ taskNumber && project?.slug
+ ? `${project.slug}-${taskNumber}`.toLowerCase()
+ : "";
const taskShortIdentifier = taskNumber ? `#${taskNumber}` : "";
const matchesText =
title.includes(normalizedTextQuery) ||