⚡ 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): repair typecheck and address review
Juan278f72a952ec
diff --git a/apps/web/src/components/list-view/index.tsx b/apps/web/src/components/list-view/index.tsxindex 1847dbe90..5ce952fcb 100644--- a/apps/web/src/components/list-view/index.tsx+++ b/apps/web/src/components/list-view/index.tsx@@ -292,6 +292,13 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {setProject(updatedProject);};+ // Escape ends a drag without onDragEnd, so without this the dragged row+ // stays active: its children remain collapsed and the overlay lingers.+ const handleDragCancel = () => {+ setActiveId(null);+ setOverColumnId(null);+ };+const toggleSection = (sectionId: string) => {setExpandedSections((prev) => ({...prev,@@ -491,6 +498,7 @@ function ListView({ project, disableDragDrop = false }: ListViewProps) {onDragStart={handleDragStart}onDragOver={handleDragOver}onDragEnd={handleDragEnd}+ onDragCancel={handleDragCancel}modifiers={[snapCenterToCursor]}><div className="w-full h-full overflow-auto bg-muted/20">diff --git a/apps/web/src/components/list-view/task-row.test.tsx b/apps/web/src/components/list-view/task-row.test.tsxindex f4466cdcb..dd2117348 100644--- a/apps/web/src/components/list-view/task-row.test.tsx+++ b/apps/web/src/components/list-view/task-row.test.tsx@@ -8,6 +8,7 @@ const useGetLabelsByTask = vi.fn((_taskId: string) => ({ data: [] }));afterEach(() => {cleanup();+ interpolations.length = 0;vi.clearAllMocks();});@@ -64,8 +65,15 @@ vi.mock("@/store/user-preferences", () => ({}),}));+const interpolations: Record<string, unknown>[] = [];+vi.mock("react-i18next", () => ({- useTranslation: () => ({ t: (key: string) => key }),+ useTranslation: () => ({+ t: (key: string, options?: Record<string, unknown>) => {+ if (options) interpolations.push(options);+ return key;+ },+ }),initReactI18next: { type: "3rdParty", init: vi.fn() },}));@@ -191,6 +199,21 @@ describe("TaskRow", () => {).not.toBeInTheDocument();});+ it("names the toggle by its task, not the action alone", () => {+ render(+ <TaskRow+ task={task}+ projectSlug="kan"+ childCount={1}+ onToggleExpanded={vi.fn()}+ />,+ );++ // Several rows each offering "Show subtasks" would be indistinguishable,+ // so the label interpolates the title.+ expect(interpolations).toContainEqual({ title: "Row from payload" });+ });+it("labels the toggle by its resulting state", () => {render(<TaskRowdiff --git a/apps/web/src/components/list-view/task-row.tsx b/apps/web/src/components/list-view/task-row.tsxindex 7d11c6762..65502776e 100644--- a/apps/web/src/components/list-view/task-row.tsx+++ b/apps/web/src/components/list-view/task-row.tsx@@ -240,10 +240,13 @@ function TaskRow({type="button"onClick={onToggleExpanded}aria-expanded={isExpanded}+ // Named with the task, not just the action: the toggle sits+ // outside the row's own control, so several identical "Show+ // subtasks" buttons would be indistinguishable in a rotor.aria-label={isExpanded- ? t("tasks:listView.collapseSubtasks")- : t("tasks:listView.expandSubtasks")+ ? t("tasks:listView.collapseSubtasks", { title: task.title })+ : t("tasks:listView.expandSubtasks", { title: task.title })}className="flex-shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground">diff --git a/apps/web/src/hooks/use-project-websocket.test.tsx b/apps/web/src/hooks/use-project-websocket.test.tsxindex d11e574b4..9bd4420be 100644--- a/apps/web/src/hooks/use-project-websocket.test.tsx+++ b/apps/web/src/hooks/use-project-websocket.test.tsx@@ -1,4 +1,12 @@-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import {+ afterEach,+ beforeEach,+ describe,+ expect,+ it,+ type MockInstance,+ vi,+} from "vitest";vi.mock("@kaneo/libs", () => ({windowId: "test-window-id",@@ -74,12 +82,13 @@ type Socket = {describe("useProjectWebSocket message handling", () => {let socket: Socket;- let invalidate: ReturnType<typeof vi.fn>;+ let invalidate: MockInstance<QueryClient["invalidateQueries"]>;function mount() {const client = new QueryClient();- invalidate = vi.fn();- client.invalidateQueries = invalidate;+ invalidate = vi+ .spyOn(client, "invalidateQueries")+ .mockResolvedValue(undefined);renderHook(() => {@@ -141,7 +150,18 @@ describe("useProjectWebSocket message handling", () => {// The project-scoped relations query is what the list view reads, and no// per-task key reaches it.- it.each(["TASK_RELATION_UPDATED", "TASK_DELETED", "TASK_MOVED"])(+ it("refreshes the project relations on a real relation change", () => {+ receive({+ type: "TASK_RELATION_UPDATED",+ projectId: "project-1",+ sourceTaskId: "task-1",+ targetTaskId: "task-2",+ });++ expect(invalidatedKeys()).toContain(projectRelationsKey);+ });++ it.each(["TASK_DELETED", "TASK_MOVED"])("refreshes the project relations on %s",(type) => {receive({ type, projectId: "project-1", taskId: "task-1" });@@ -150,6 +170,32 @@ describe("useProjectWebSocket message handling", () => {},);+ // The API publishes task-relation.refresh on every status change, and the+ // socket relays it as TASK_RELATION_UPDATED with no endpoint ids. That+ // stales the per-task queries, whose responses embed each linked task's+ // status, but not the project query, which returns edges alone.+ it("does not refresh the project relations on a status refresh", () => {+ receive({ type: "TASK_RELATION_UPDATED", projectId: "project-1" });++ expect(invalidatedKeys()).not.toContain(projectRelationsKey);+ });++ it("still refreshes the per-task relations on a status refresh", () => {+ receive({ type: "TASK_RELATION_UPDATED", projectId: "project-1" });++ const predicates = invalidate.mock.calls+ .map((call) => call[0]?.predicate)+ .filter(Boolean);+ expect(predicates).toHaveLength(1);++ const matches = (queryKey: readonly unknown[]) =>+ // biome-ignore lint/suspicious/noExplicitAny: only queryKey is read+ predicates[0]?.({ queryKey } as any);++ expect(matches(["task-relations", "task-9"])).toBe(true);+ expect(matches(["task-relations", "project", "project-1"])).toBe(false);+ });+// Creating a task inserts no relation: a subtask is a create followed by a// separate relation mutation, which emits its own event.it.each([diff --git a/apps/web/src/hooks/use-project-websocket.ts b/apps/web/src/hooks/use-project-websocket.tsindex abaa5a02a..5760e7119 100644--- a/apps/web/src/hooks/use-project-websocket.ts+++ b/apps/web/src/hooks/use-project-websocket.ts@@ -76,9 +76,13 @@ export function useProjectWebSocket(projectId: string) {// list a refetch.// Creating a task inserts no relation — a subtask is a create// followed by a separate relation mutation, which emits its own- // event — so only these three can change the edge set.+ // event. TASK_RELATION_UPDATED also carries `task-relation.refresh`,+ // which the API publishes on every status change with no endpoint+ // ids; that changes the per-task responses, which embed task+ // status, but not the project response, which is edges only.if (- message.type === "TASK_RELATION_UPDATED" ||+ (message.type === "TASK_RELATION_UPDATED" &&+ (message.sourceTaskId || message.targetTaskId)) ||message.type === "TASK_DELETED" ||message.type === "TASK_MOVED") {@@ -105,8 +109,14 @@ export function useProjectWebSocket(projectId: string) {});}if (!message.sourceTaskId && !message.targetTaskId) {+ // Every per-task relation query, but not the project one:+ // those responses embed each linked task's status, so a status+ // change stales them, while the project query returns edges+ // alone and a prefix match would refetch it needlessly.queryClient.invalidateQueries({- queryKey: ["task-relations"],+ predicate: (query) =>+ query.queryKey[0] === "task-relations" &&+ query.queryKey[1] !== "project",});}} else {diff --git a/apps/web/src/lib/subtask-tree.ts b/apps/web/src/lib/subtask-tree.tsindex ba24251b1..ea68b911c 100644--- a/apps/web/src/lib/subtask-tree.ts+++ b/apps/web/src/lib/subtask-tree.ts@@ -27,7 +27,11 @@ export type SubtaskRow<T> = {export function buildSubtaskChildren(relations: readonly TaskRelationEdge[],): Map<string, string[]> {- const children = new Map<string, string[]>();+ // A Set rather than scanning the accumulated array: this runs on every+ // relation response, and `includes` per edge is quadratic in one parent's+ // children. Insertion order is preserved, so the rendered order is the order+ // the relations arrived in.+ const children = new Map<string, Set<string>>();for (const relation of relations) {if (relation.relationType !== "subtask") continue;@@ -35,15 +39,15 @@ export function buildSubtaskChildren(const existing = children.get(relation.sourceTaskId);if (existing) {- if (!existing.includes(relation.targetTaskId)) {- existing.push(relation.targetTaskId);- }+ existing.add(relation.targetTaskId);} else {- children.set(relation.sourceTaskId, [relation.targetTaskId]);+ children.set(relation.sourceTaskId, new Set([relation.targetTaskId]));}}- return children;+ return new Map(+ [...children].map(([parentId, childIds]) => [parentId, [...childIds]]),+ );}/**diff --git a/i18n/az-AZ.json b/i18n/az-AZ.jsonindex 5ba05f604..8cec448aa 100644--- a/i18n/az-AZ.json+++ b/i18n/az-AZ.json@@ -1980,8 +1980,8 @@"addTask": "Tapşırıq əlavə et","archiveAllTooltip": "Bütün tamamlanmış tapşırıqları arxivlə","noTasks": "Tapşırıq yoxdur",- "collapseSubtasks": "Alt tapşırıqları gizlət",- "expandSubtasks": "Alt tapşırıqları göstər",+ "collapseSubtasks": "{{title}} alt tapşırıqlarını gizlət",+ "expandSubtasks": "{{title}} alt tapşırıqlarını göstər","subtaskLevel": "Alt tapşırıq, səviyyə {{level}}"},"kanban": {diff --git a/i18n/de-DE.json b/i18n/de-DE.jsonindex c31d7bb4d..770fe8217 100644--- a/i18n/de-DE.json+++ b/i18n/de-DE.json@@ -1967,8 +1967,8 @@"addTask": "Aufgabe hinzufügen","archiveAllTooltip": "Alle abgeschlossenen Aufgaben archivieren","noTasks": "Keine Aufgaben",- "collapseSubtasks": "Teilaufgaben ausblenden",- "expandSubtasks": "Teilaufgaben anzeigen",+ "collapseSubtasks": "Teilaufgaben von {{title}} ausblenden",+ "expandSubtasks": "Teilaufgaben von {{title}} anzeigen","subtaskLevel": "Teilaufgabe, Ebene {{level}}"},"kanban": {diff --git a/i18n/el-GR.json b/i18n/el-GR.jsonindex 04b9943a5..cc25e1307 100644--- a/i18n/el-GR.json+++ b/i18n/el-GR.json@@ -1967,8 +1967,8 @@"addTask": "Προσθήκη εργασίας","archiveAllTooltip": "Αρχειοθέτηση όλων των ολοκληρωμένων εργασιών","noTasks": "Δεν υπάρχουν εργασίες",- "collapseSubtasks": "Απόκρυψη υποεργασιών",- "expandSubtasks": "Εμφάνιση υποεργασιών",+ "collapseSubtasks": "Απόκρυψη υποεργασιών του {{title}}",+ "expandSubtasks": "Εμφάνιση υποεργασιών του {{title}}","subtaskLevel": "Υποεργασία, επίπεδο {{level}}"},"kanban": {diff --git a/i18n/en-US.json b/i18n/en-US.jsonindex d88fbbb20..098d27446 100644--- a/i18n/en-US.json+++ b/i18n/en-US.json@@ -1980,8 +1980,8 @@"addTask": "Add task","archiveAllTooltip": "Archive all completed tasks","noTasks": "No tasks",- "expandSubtasks": "Show subtasks",- "collapseSubtasks": "Hide subtasks",+ "expandSubtasks": "Show subtasks of {{title}}",+ "collapseSubtasks": "Hide subtasks of {{title}}","subtaskLevel": "Subtask, level {{level}}"},"kanban": {diff --git a/i18n/es-ES.json b/i18n/es-ES.jsonindex 96453586a..192ca3cb5 100644--- a/i18n/es-ES.json+++ b/i18n/es-ES.json@@ -1961,8 +1961,8 @@"addTask": "Añadir tarea","archiveAllTooltip": "Archivar todas las tareas completadas","noTasks": "No hay tareas",- "collapseSubtasks": "Ocultar sub-tareas",- "expandSubtasks": "Mostrar sub-tareas",+ "collapseSubtasks": "Ocultar sub-tareas de {{title}}",+ "expandSubtasks": "Mostrar sub-tareas de {{title}}","subtaskLevel": "Sub-tarea, nivel {{level}}"},"kanban": {diff --git a/i18n/fr-FR.json b/i18n/fr-FR.jsonindex 551968b3f..136916fed 100644--- a/i18n/fr-FR.json+++ b/i18n/fr-FR.json@@ -1972,8 +1972,8 @@"addTask": "Ajouter une tâche","archiveAllTooltip": "Archiver toutes les tâches terminées","noTasks": "Aucune tâche",- "collapseSubtasks": "Masquer les sous-tâches",- "expandSubtasks": "Afficher les sous-tâches",+ "collapseSubtasks": "Masquer les sous-tâches de {{title}}",+ "expandSubtasks": "Afficher les sous-tâches de {{title}}","subtaskLevel": "Sous-tâche, niveau {{level}}"},"kanban": {diff --git a/i18n/hi-IN.json b/i18n/hi-IN.jsonindex 75cbba06b..67b49187e 100644--- a/i18n/hi-IN.json+++ b/i18n/hi-IN.json@@ -1967,8 +1967,8 @@"addTask": "कार्य जोड़ें","archiveAllTooltip": "सभी पूर्ण कार्य संग्रहित करें","noTasks": "कोई कार्य नहीं",- "collapseSubtasks": "उप-कार्य छिपाएँ",- "expandSubtasks": "उप-कार्य दिखाएँ",+ "collapseSubtasks": "{{title}} के उप-कार्य छिपाएँ",+ "expandSubtasks": "{{title}} के उप-कार्य दिखाएँ","subtaskLevel": "उप-कार्य, स्तर {{level}}"},"kanban": {diff --git a/i18n/id-ID.json b/i18n/id-ID.jsonindex 28876a582..00f256571 100644--- a/i18n/id-ID.json+++ b/i18n/id-ID.json@@ -1962,8 +1962,8 @@"addTask": "Tambah tugas","archiveAllTooltip": "Arsipkan semua tugas yang selesai","noTasks": "Tidak ada tugas",- "collapseSubtasks": "Sembunyikan subtugas",- "expandSubtasks": "Tampilkan subtugas",+ "collapseSubtasks": "Sembunyikan subtugas {{title}}",+ "expandSubtasks": "Tampilkan subtugas {{title}}","subtaskLevel": "Subtugas, tingkat {{level}}"},"kanban": {diff --git a/i18n/it-IT.json b/i18n/it-IT.jsonindex dd8a97b8c..fb841c60e 100644--- a/i18n/it-IT.json+++ b/i18n/it-IT.json@@ -1972,8 +1972,8 @@"addTask": "Aggiungi attività","archiveAllTooltip": "Archivia tutte le attività completate","noTasks": "Nessuna attività",- "collapseSubtasks": "Nascondi sotto-attività",- "expandSubtasks": "Mostra sotto-attività",+ "collapseSubtasks": "Nascondi sotto-attività di {{title}}",+ "expandSubtasks": "Mostra sotto-attività di {{title}}","subtaskLevel": "Sotto-attività, livello {{level}}"},"kanban": {diff --git a/i18n/ja-JP.json b/i18n/ja-JP.jsonindex ce2c67f00..5f10175d6 100644--- a/i18n/ja-JP.json+++ b/i18n/ja-JP.json@@ -1975,8 +1975,8 @@"addTask": "タスクを追加","archiveAllTooltip": "完了したタスクをすべてアーカイブ","noTasks": "タスクはありません",- "collapseSubtasks": "サブタスクを非表示",- "expandSubtasks": "サブタスクを表示",+ "collapseSubtasks": "{{title}} のサブタスクを非表示",+ "expandSubtasks": "{{title}} のサブタスクを表示","subtaskLevel": "サブタスク、レベル {{level}}"},"kanban": {diff --git a/i18n/ko-KR.json b/i18n/ko-KR.jsonindex fe76cb0de..7498c018e 100644--- a/i18n/ko-KR.json+++ b/i18n/ko-KR.json@@ -1975,8 +1975,8 @@"addTask": "작업 추가","archiveAllTooltip": "완료된 모든 작업 보관","noTasks": "작업 없음",- "collapseSubtasks": "하위 작업 숨기기",- "expandSubtasks": "하위 작업 표시",+ "collapseSubtasks": "{{title}}의 하위 작업 숨기기",+ "expandSubtasks": "{{title}}의 하위 작업 표시","subtaskLevel": "하위 작업, {{level}}단계"},"kanban": {diff --git a/i18n/mk-MK.json b/i18n/mk-MK.jsonindex cf6789be5..ddb48fcd7 100644--- a/i18n/mk-MK.json+++ b/i18n/mk-MK.json@@ -1967,8 +1967,8 @@"addTask": "Додади задача","archiveAllTooltip": "Архивирај ги сите завршени задачи","noTasks": "Нема задачи",- "collapseSubtasks": "Сокриј подзадачи",- "expandSubtasks": "Прикажи подзадачи",+ "collapseSubtasks": "Сокриј подзадачи на {{title}}",+ "expandSubtasks": "Прикажи подзадачи на {{title}}","subtaskLevel": "Подзадача, ниво {{level}}"},"kanban": {diff --git a/i18n/nl-NL.json b/i18n/nl-NL.jsonindex 376fcdab6..b49190dbc 100644--- a/i18n/nl-NL.json+++ b/i18n/nl-NL.json@@ -1956,8 +1956,8 @@"addTask": "Taak toevoegen","archiveAllTooltip": "Alle voltooide taken archiveren","noTasks": "Geen taken",- "collapseSubtasks": "Subtaken verbergen",- "expandSubtasks": "Subtaken tonen",+ "collapseSubtasks": "Subtaken van {{title}} verbergen",+ "expandSubtasks": "Subtaken van {{title}} tonen","subtaskLevel": "Subtaak, niveau {{level}}"},"kanban": {diff --git a/i18n/pl-PL.json b/i18n/pl-PL.jsonindex eb469ca84..ccea145fa 100644--- a/i18n/pl-PL.json+++ b/i18n/pl-PL.json@@ -2112,8 +2112,8 @@"addTask": "Dodaj zadanie","archiveAllTooltip": "Archiwizuj wszystkie ukończone zadania","noTasks": "Brak zadań",- "collapseSubtasks": "Ukryj podzadania",- "expandSubtasks": "Pokaż podzadania",+ "collapseSubtasks": "Ukryj podzadania {{title}}",+ "expandSubtasks": "Pokaż podzadania {{title}}","subtaskLevel": "Podzadanie, poziom {{level}}"},"move": {diff --git a/i18n/pt-BR.json b/i18n/pt-BR.jsonindex 04b6f1332..68cc7e50e 100644--- a/i18n/pt-BR.json+++ b/i18n/pt-BR.json@@ -1972,8 +1972,8 @@"addTask": "Adicionar tarefa","archiveAllTooltip": "Arquivar todas as tarefas concluídas","noTasks": "Nenhuma tarefa",- "collapseSubtasks": "Ocultar subtarefas",- "expandSubtasks": "Mostrar subtarefas",+ "collapseSubtasks": "Ocultar subtarefas de {{title}}",+ "expandSubtasks": "Mostrar subtarefas de {{title}}","subtaskLevel": "Subtarefa, nível {{level}}"},"kanban": {diff --git a/i18n/ru-RU.json b/i18n/ru-RU.jsonindex 1f178226e..16f09102e 100644--- a/i18n/ru-RU.json+++ b/i18n/ru-RU.json@@ -1997,8 +1997,8 @@"addTask": "Добавить задачу","archiveAllTooltip": "Архивировать все завершённые задачи","noTasks": "Нет задач",- "collapseSubtasks": "Скрыть подзадачи",- "expandSubtasks": "Показать подзадачи",+ "collapseSubtasks": "Скрыть подзадачи «{{title}}»",+ "expandSubtasks": "Показать подзадачи «{{title}}»","subtaskLevel": "Подзадача, уровень {{level}}"},"kanban": {diff --git a/i18n/tr-TR.json b/i18n/tr-TR.jsonindex a5fc01560..3767ee5c2 100644--- a/i18n/tr-TR.json+++ b/i18n/tr-TR.json@@ -1967,8 +1967,8 @@"addTask": "Talep ekle","archiveAllTooltip": "Tüm tamamlanmış talepleri arşivle","noTasks": "Talep yok",- "collapseSubtasks": "Alt talepleri gizle",- "expandSubtasks": "Alt talepleri göster",+ "collapseSubtasks": "{{title}} alt taleplerini gizle",+ "expandSubtasks": "{{title}} alt taleplerini göster","subtaskLevel": "Alt talep, seviye {{level}}"},"kanban": {diff --git a/i18n/uk-UA.json b/i18n/uk-UA.jsonindex b9b35ac4c..206a37b17 100644--- a/i18n/uk-UA.json+++ b/i18n/uk-UA.json@@ -1977,8 +1977,8 @@"addTask": "Додати завдання","archiveAllTooltip": "Архівувати всі завершені завдання","noTasks": "Немає завдань",- "collapseSubtasks": "Приховати підзавдання",- "expandSubtasks": "Показати підзавдання",+ "collapseSubtasks": "Приховати підзавдання «{{title}}»",+ "expandSubtasks": "Показати підзавдання «{{title}}»","subtaskLevel": "Підзавдання, рівень {{level}}"},"kanban": {diff --git a/i18n/vi-VN.json b/i18n/vi-VN.jsonindex 218d3cfbd..d5c4f39d2 100644--- a/i18n/vi-VN.json+++ b/i18n/vi-VN.json@@ -1962,8 +1962,8 @@"addTask": "Thêm công việc","archiveAllTooltip": "Lưu trữ tất cả công việc đã hoàn thành","noTasks": "Không có công việc",- "collapseSubtasks": "Ẩn công việc con",- "expandSubtasks": "Hiện công việc con",+ "collapseSubtasks": "Ẩn công việc con của {{title}}",+ "expandSubtasks": "Hiện công việc con của {{title}}","subtaskLevel": "Công việc con, cấp {{level}}"},"kanban": {diff --git a/i18n/zh-CN.json b/i18n/zh-CN.jsonindex 77b18d225..223a4e6c5 100644--- a/i18n/zh-CN.json+++ b/i18n/zh-CN.json@@ -1975,8 +1975,8 @@"addTask": "添加任务","archiveAllTooltip": "归档所有已完成任务","noTasks": "无任务",- "collapseSubtasks": "隐藏子任务",- "expandSubtasks": "显示子任务",+ "collapseSubtasks": "隐藏 {{title}} 的子任务",+ "expandSubtasks": "显示 {{title}} 的子任务","subtaskLevel": "子任务,第 {{level}} 层"},"kanban": {