⚡ 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(board): preserve labels across fetches and remote renames
Tin52eb2d171ac5
diff --cc apps/web/src/hooks/mutations/label/sync-task-labels-cache.test.tsindex a887a04ca,a887a04ca..81f2fc1bb--- a/apps/web/src/hooks/mutations/label/sync-task-labels-cache.test.ts+++ b/apps/web/src/hooks/mutations/label/sync-task-labels-cache.test.ts@@@ -1,5 -1,5 +1,11 @@@++import { QueryClient } from "@tanstack/react-query";++import type { ProjectWithTasks } from "@/types/project";import { describe, expect, it } from "vite-plus/test";--import { updateTaskLabelsInProject } from "./sync-task-labels-cache";++import {++ addLabelToTaskInTasksCache,++ removeLabelFromTaskInTasksCache,++ updateTaskLabelsInProject,++} from "./sync-task-labels-cache";describe("updateTaskLabelsInProject", () => {it("adds a label to the matching task without changing other tasks", () => {@@@ -177,3 -177,3 +183,44 @@@]);});});++++it.each(["attach", "detach"])(++ "preserves a local label %s after an older board fetch completes",++ async (action) => {++ const client = new QueryClient();++ const label = { id: "label", name: "bug", color: "red" };++ const board = {++ id: "project",++ columns: [++ {++ id: "todo",++ tasks: [{ id: "task", labels: action === "attach" ? [] : [label] }],++ },++ ],++ plannedTasks: [],++ archivedTasks: [],++ } as unknown as ProjectWithTasks;++ client.setQueryData(["tasks", "project"], board);++ let release!: () => void;++ const wait = new Promise<void>((resolve) => {++ release = resolve;++ });++ const fetch = client.fetchQuery({++ queryKey: ["tasks", "project"],++ queryFn: async () => {++ await wait;++ return board;++ },++ staleTime: 0,++ });++ if (action === "attach") addLabelToTaskInTasksCache(client, "task", label);++ else removeLabelFromTaskInTasksCache(client, "task", label.id);++ release();++ await fetch;++ expect(++ client.getQueryData<ProjectWithTasks>(["tasks", "project"])?.columns[0]++ .tasks[0].labels,++ ).toEqual(action === "attach" ? [label] : []);++ client.clear();++ },++);diff --cc apps/web/src/hooks/mutations/label/sync-task-labels-cache.tsindex 2859a7fb8,2859a7fb8..f35b390f0--- a/apps/web/src/hooks/mutations/label/sync-task-labels-cache.ts+++ b/apps/web/src/hooks/mutations/label/sync-task-labels-cache.ts@@@ -1,3 -1,3 +1,7 @@@++import {++ getBoardCacheVersion,++ markBoardCacheChanged,++} from "@/lib/board-cache-version";import type { QueryClient } from "@tanstack/react-query";import type { ProjectWithTasks } from "@/types/project";import type Task from "@/types/task";@@@ -47,16 -47,16 +51,36 @@@ export function syncTaskLabelsInTasksCataskId: string,updater: TaskLabelsUpdater,) {-- queryClient.setQueriesData<ProjectWithTasks | undefined>(-- {-- queryKey: ["tasks"],-- predicate: (query) => query.queryKey.length === 2,-- },-- (existingProject) =>-- existingProject-- ? updateTaskLabelsInProject(existingProject, taskId, updater)-- : existingProject,-- );++ const boards = queryClient.getQueryCache().findAll({++ queryKey: ["tasks"],++ predicate: (query) => query.queryKey.length === 2,++ });++ for (const query of boards) {++ const projectId = query.queryKey[1];++ if (typeof projectId !== "string") continue;++ markBoardCacheChanged(queryClient, projectId, taskId);++ const version = getBoardCacheVersion(queryClient, projectId, taskId);++ const apply = () => {++ if (getBoardCacheVersion(queryClient, projectId, taskId) !== version) {++ void queryClient.invalidateQueries({ queryKey: query.queryKey });++ return;++ }++ queryClient.setQueryData<ProjectWithTasks>(query.queryKey, (board) =>++ board ? updateTaskLabelsInProject(board, taskId, updater) : board,++ );++ };++ if (query.state.fetchStatus === "fetching") {++ const unsubscribe = queryClient++ .getQueryCache()++ .subscribe(({ query: updated, type }) => {++ if (updated !== query) return;++ if (type === "removed" || updated.state.fetchStatus === "idle") {++ unsubscribe();++ if (type !== "removed") apply();++ }++ });++ } else apply();++ }}export function addLabelToTaskInTasksCache(diff --cc apps/web/src/hooks/use-project-websocket-cache.test.tsxindex 1ca88fa0e,000000000..a3b8cba87mode 100644,000000..100644--- a/apps/web/src/hooks/use-project-websocket-cache.test.tsx+++ b/apps/web/src/hooks/use-project-websocket-cache.test.tsx@@@ -1,475 -1,0 +1,485 @@@+import { cleanup, renderHook } from "@testing-library/react";+import {+ afterEach,+ beforeEach,+ describe,+ expect,+ it,+ vi,+} from "vite-plus/test";+import { useProjectWebSocket } from "./use-project-websocket";++const mocks = vi.hoisted(() => ({+ board: null as unknown,+ getTask: vi.fn(),+ subscribe: vi.fn(),+ client: {+ getQueryCache: () => ({+ subscribe: (listener: unknown) => {+ mocks.subscribe(listener);+ return () => {};+ },+ }),+ getQueryState: vi.fn(),+ getQueryData: vi.fn(),+ setQueryData: vi.fn(),+ invalidateQueries: vi.fn(),+ cancelQueries: vi.fn().mockResolvedValue(undefined),+ },+}));+vi.mock("@tanstack/react-query", () => ({+ useQueryClient: () => mocks.client,+}));+vi.mock("@kaneo/libs", () => ({ windowId: "test" }));+vi.mock("@/lib/auth-client", () => ({+ authClient: { useSession: () => ({ data: { user: { id: "u" } } }) },+}));+vi.mock("@/fetchers/task/get-task", () => ({ default: mocks.getTask }));+vi.mock("@/fetchers/label/get-labels-by-task", () => ({+ default: () => Promise.resolve([]),+}));+vi.mock("@/fetchers/external-link/get-external-links", () => ({+ default: () => Promise.resolve([]),+}));++class Socket {+ static current: Socket;+ onopen: (() => void) | null = null;+ onclose: (() => void) | null = null;+ onmessage: ((event: { data: string }) => void) | null = null;+ close = vi.fn();+ constructor() {+ Socket.current = this;+ }+ message(type: string, rest: Record<string, unknown>) {+ this.onmessage?.({+ data: JSON.stringify({ type, projectId: "p", ...rest }),+ });+ }+}++beforeEach(() => {+ vi.stubGlobal("WebSocket", Socket);+ mocks.board = {+ id: "p",+ columns: [+ {+ id: "todo",+ slug: "todo",+ tasks: [{ id: "a", projectId: "p", status: "todo", position: 0 }],+ },+ { id: "doing", slug: "doing", tasks: [] },+ ],+ plannedTasks: [],+ archivedTasks: [],+ };+ mocks.client.getQueryData.mockImplementation(() => mocks.board);+ mocks.client.setQueryData.mockImplementation((_key, value) => {+ mocks.board = typeof value === "function" ? value(mocks.board) : value;+ });+ mocks.client.invalidateQueries.mockReset();+ mocks.client.getQueryState.mockReset();+ mocks.subscribe.mockClear();+});+afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+});++describe("board realtime races", () => {+ it.each(["TASKS_REORDERED", "PROJECT_UPDATED", "TASK_RELATION_UPDATED"])(+ "discards a task refresh started before %s",+ async (type) => {+ let finish!: (value: unknown) => void;+ mocks.getTask.mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finish = resolve;+ }),+ );+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASK_UPDATED", { taskId: "a" });+ Socket.current.message(type, {+ tasks: [{ id: "a", position: 2, status: "doing" }],+ });+ const afterEvent = mocks.board;+ finish({ id: "a", projectId: "p", status: "todo", position: 0 });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ expect(mocks.board).toBe(afterEvent);+ if (type === "TASKS_REORDERED")+ expect(+ (mocks.board as { columns: { tasks: { id: string }[] }[] }).columns[1]+ .tasks[0].id,+ ).toBe("a");+ },+ );++ it("coalesces updates while pagination finishes without restarting page one", async () => {+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "fetching" });+ mocks.getTask.mockReset();+ mocks.getTask.mockResolvedValue({+ id: "a",+ projectId: "p",+ status: "doing",+ position: 2,+ });+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASK_UPDATED", { taskId: "a" });+ Socket.current.message("TASK_UPDATED", { taskId: "a" });+ expect(mocks.getTask).not.toHaveBeenCalled();+ expect(mocks.client.invalidateQueries).not.toHaveBeenCalled();+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "idle" });+ mocks.subscribe.mock.calls[0][0]({+ query: { queryKey: ["tasks", "p"], state: { fetchStatus: "idle" } },+ });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ expect(mocks.getTask).toHaveBeenCalledExactlyOnceWith("a", "board");+ expect(mocks.client.invalidateQueries).not.toHaveBeenCalledWith({+ queryKey: ["tasks", "p"],+ });+ });++ it("refreshes a project-wide task update with no task id", () => {+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASK_UPDATED", { taskId: "" });+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: ["tasks", "p"],+ });+ });+});++it("reconciles the initial handshake after active pagination completes", async () => {+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "fetching" });+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.onopen?.();+ await Promise.resolve();+ expect(mocks.client.invalidateQueries).not.toHaveBeenCalled();+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "idle" });+ mocks.subscribe.mock.calls[0][0]({+ query: { queryKey: ["tasks", "p"], state: { fetchStatus: "idle" } },+ });+ await Promise.resolve();+ expect(mocks.client.invalidateQueries).toHaveBeenCalledExactlyOnceWith({+ queryKey: ["tasks", "p"],+ });+});+it("preserves distinct task effects across pagination and a disconnect before replay", async () => {+ vi.useFakeTimers();+ try {+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "fetching" });+ mocks.getTask.mockResolvedValue({+ id: "a",+ projectId: "p",+ status: "todo",+ });+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("COMMENT_UPDATED", { taskId: "a" });+ Socket.current.message("TASK_LABEL_UPDATED", { taskId: "a" });+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "idle" });+ mocks.subscribe.mock.calls[0][0]({+ query: { queryKey: ["tasks", "p"], state: { fetchStatus: "idle" } },+ });+ Socket.current.onclose?.();+ await Promise.resolve();+ await vi.advanceTimersByTimeAsync(1000);+ Socket.current.onopen?.();+ await vi.advanceTimersByTimeAsync(0);+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: ["comments", "a"],+ });+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: ["labels", "a"],+ });+ } finally {+ vi.useRealTimers();+ }+});++it("does not overwrite a parent's newer progress with an older child's response", async () => {+ let finish!: (value: unknown) => void;+ mocks.getTask+ .mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finish = resolve;+ }),+ )+ .mockResolvedValueOnce({+ id: "b",+ projectId: "p",+ status: "todo",+ parentSubtaskCounts: [{ taskId: "a", completed: 2, total: 2 }],+ });+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASK_UPDATED", { taskId: "old-child" });+ Socket.current.message("TASK_UPDATED", { taskId: "b" });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ finish({+ id: "old-child",+ projectId: "p",+ status: "todo",+ parentSubtaskCounts: [{ taskId: "a", completed: 1, total: 2 }],+ });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ const task = (+ mocks.board as {+ columns: { tasks: { id: string; subtaskCounts?: unknown }[] }[];+ }+ ).columns[0].tasks.find((task) => task.id === "a");+ expect(task?.subtaskCounts).toEqual({ completed: 2, total: 2 });+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: ["tasks", "p"],+ });+});++it("preserves newer parent progress when an earlier parent refresh finishes last", async () => {+ let finish!: (value: unknown) => void;+ mocks.getTask+ .mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finish = resolve;+ }),+ )+ .mockResolvedValueOnce({+ id: "b",+ projectId: "p",+ status: "todo",+ parentSubtaskCounts: [{ taskId: "a", completed: 2, total: 2 }],+ });+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASK_UPDATED", { taskId: "a" });+ Socket.current.message("TASK_UPDATED", { taskId: "b" });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ finish({+ id: "a",+ projectId: "p",+ status: "todo",+ subtaskCounts: { completed: 1, total: 2 },+ });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ const task = (+ mocks.board as {+ columns: { tasks: { id: string; subtaskCounts?: unknown }[] }[];+ }+ ).columns[0].tasks.find((task) => task.id === "a");+ expect(task?.subtaskCounts).toEqual({ completed: 2, total: 2 });+});++it("bounds per-task reads during a thousand-event burst and reconciles once", async () => {+ vi.useFakeTimers();+ try {+ mocks.getTask.mockReset().mockImplementation(() => new Promise(() => {}));+ renderHook(() => useProjectWebSocket("p"));+ for (let i = 0; i < 1000; i++)+ Socket.current.message("TASK_UPDATED", { taskId: `task-${i}` });+ expect(mocks.getTask).toHaveBeenCalledTimes(4);+ await vi.advanceTimersByTimeAsync(200);+ expect(+ mocks.client.invalidateQueries.mock.calls.filter(+ ([options]) => options.queryKey[0] === "tasks",+ ),+ ).toHaveLength(1);+ expect(mocks.getTask).toHaveBeenCalledTimes(4);+ } finally {+ vi.useRealTimers();+ }+});++it("applies remote reorders to virtual task buckets", () => {+ const board = mocks.board as {+ plannedTasks: unknown[];+ archivedTasks: unknown[];+ };+ board.plannedTasks = [+ { id: "p1", projectId: "p", status: "planned", position: 0 },+ { id: "p2", projectId: "p", status: "planned", position: 1 },+ ];+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASKS_REORDERED", {+ tasks: [+ { id: "p1", position: 1 },+ { id: "p2", position: 0 },+ ],+ });+ expect(+ (mocks.board as { plannedTasks: { id: string }[] }).plannedTasks.map(+ (task) => task.id,+ ),+ ).toEqual(["p2", "p1"]);+});++it("reconciles a remote read superseded by a narrow local mutation", async () => {+ const { markBoardCacheChanged } = await import("@/lib/board-cache-version");+ let finish!: (value: unknown) => void;+ mocks.getTask.mockImplementationOnce(+ () =>+ new Promise((resolve) => {+ finish = resolve;+ }),+ );+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASK_UPDATED", { taskId: "a" });+ markBoardCacheChanged(mocks.client as never, "p", "a");+ finish({ id: "a", projectId: "p", status: "todo", dueDate: "2026-10-01" });+ await Promise.resolve();+ await Promise.resolve();+ await Promise.resolve();+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: ["tasks", "p"],+ });+});++it("applies a remote reorder across virtual buckets without waiting for HTTP", () => {+ const board = mocks.board as {+ columns: {+ tasks: { id: string; status: string; columnId: string | null }[];+ }[];+ plannedTasks: {+ id: string;+ projectId: string;+ status: string;+ position: number;+ }[];+ };+ board.plannedTasks = [+ { id: "planned", projectId: "p", status: "planned", position: 0 },+ ];+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("TASKS_REORDERED", {+ tasks: [+ { id: "planned", position: 1, status: "todo" },+ { id: "a", position: 0, status: "archived" },+ ],+ });+ expect((mocks.board as typeof board).plannedTasks).toEqual([]);+ expect((mocks.board as typeof board).columns[0].tasks).toContainEqual(+ expect.objectContaining({ id: "planned", status: "todo" }),+ );+ expect(+ (mocks.board as { archivedTasks: unknown[] }).archivedTasks,+ ).toContainEqual(+ expect.objectContaining({ id: "a", status: "archived", columnId: null }),+ );+});++it.each(["TASK_CREATED", "TASK_DELETED", "TASK_MOVED", "TASKS_REORDERED"])(+ "reconciles page boundaries after %s arrives during pagination",+ async (type) => {+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "fetching" });+ mocks.getTask.mockReset();+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message(type, {+ taskId: "a",+ tasks: [{ id: "a", position: 2 }],+ });+ Socket.current.message(type, {+ taskId: "b",+ tasks: [{ id: "b", position: 0 }],+ });+ expect(mocks.client.invalidateQueries).not.toHaveBeenCalledWith({+ queryKey: ["tasks", "p"],+ });+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "idle" });+ mocks.client.invalidateQueries.mockImplementation(({ queryKey }) => {+ if (queryKey[0] === "tasks")+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "fetching" });+ });+ const idle = () =>+ mocks.subscribe.mock.calls[0][0]({+ query: { queryKey: ["tasks", "p"], state: { fetchStatus: "idle" } },+ });+ idle();+ await Promise.resolve();+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "idle" });+ idle();+ await Promise.resolve();+ expect(+ mocks.client.invalidateQueries.mock.calls.filter(+ ([options]) => options.queryKey[0] === "tasks",+ ),+ ).toHaveLength(1);+ expect(mocks.getTask).not.toHaveBeenCalled();+ },+);++it.each(["TASK_UPDATED", "TASK_CREATED", "TASK_MOVED", "TASK_LABEL_UPDATED"])(+ "keeps detail invalidation without board-only reads for %s",+ (type) => {+ mocks.board = undefined;+ mocks.getTask.mockReset();+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message(type, { taskId: "a" });+ expect(mocks.getTask).not.toHaveBeenCalled();+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: ["task", "a"],+ });+ },+);++it("drains queued detail events after retries fall back to polling", async () => {+ vi.useFakeTimers();+ try {+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "fetching" });+ renderHook(() => useProjectWebSocket("p"));+ Socket.current.message("COMMENT_UPDATED", { taskId: "a" });+ Socket.current.message("TASK_LABEL_UPDATED", { taskId: "a" });+ Socket.current.message("TASK_UPDATED", { taskId: "a" });+ Socket.current.message("TASK_RELATION_UPDATED", {+ sourceTaskId: "a",+ targetTaskId: "b",+ });+ for (const delay of [1000, 2000, 4000, 8000, 16000]) {+ Socket.current.onclose?.();+ await vi.advanceTimersByTimeAsync(delay);+ }+ Socket.current.onclose?.();+ mocks.client.invalidateQueries.mockClear();+ mocks.getTask.mockClear();+ mocks.client.getQueryState.mockReturnValue({ fetchStatus: "idle" });+ const listener = mocks.subscribe.mock.calls[0][0] as (+ event: unknown,+ ) => void;+ listener({+ query: { queryKey: ["tasks", "p"], state: { fetchStatus: "idle" } },+ });+ await vi.runAllTicks();+ for (const key of [+ ["comments", "a"],+ ["activities", "a"],+ ["labels", "a"],+ ["task", "a"],+ ["external-links", "a"],+ ["task-relations", "b"],+ ])+ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({+ queryKey: key,+ });+ expect(mocks.getTask).not.toHaveBeenCalled();+ } finally {+ cleanup();+ vi.useRealTimers();+ }+});++++it("refreshes workspace label filters when a remote project event changes labels", async () => {++ renderHook(() => useProjectWebSocket("p"));++ Socket.current.message("PROJECT_UPDATED", {});++ await vi.waitFor(() =>++ expect(mocks.client.invalidateQueries).toHaveBeenCalledWith({++ queryKey: ["labels"],++ }),++ );++});diff --cc apps/web/src/hooks/use-project-websocket.tsindex a4f00fdcf,b6355f9a2..fabd85c6f--- a/apps/web/src/hooks/use-project-websocket.ts+++ b/apps/web/src/hooks/use-project-websocket.ts@@@ -56,75 -30,7 +56,76 @@@ export function useProjectWebSocket(prolet activeSocket: WebSocket | null = null;let retries = 0;let retryTimeout: ReturnType<typeof setTimeout> | null = null;+ let healthyTimeout: ReturnType<typeof setTimeout> | null = null;+ let requestSequence = 0;+ const parentCountVersions = new Map<string, number>();let pingInterval: ReturnType<typeof setInterval> | null = null;+ let fallbackInterval: ReturnType<typeof setInterval> | null = null;++ function invalidateDetails(message: {+ type: string;+ taskId?: string;+ sourceTaskId?: string;+ targetTaskId?: string;+ }) {+ if (message.type === "PROJECT_UPDATED") {+ queryClient.invalidateQueries({ queryKey: ["projects"] });++ queryClient.invalidateQueries({ queryKey: ["labels"] });+ return;+ }++ if (message.type === "TASK_RELATION_UPDATED") {+ if (message.sourceTaskId) {+ queryClient.invalidateQueries({+ queryKey: ["task", message.sourceTaskId],+ });+ queryClient.invalidateQueries({+ queryKey: ["task-relations", message.sourceTaskId],+ });+ }+ if (message.targetTaskId) {+ queryClient.invalidateQueries({+ queryKey: ["task", message.targetTaskId],+ });+ queryClient.invalidateQueries({+ queryKey: ["task-relations", message.targetTaskId],+ });+ }+ if (!message.sourceTaskId && !message.targetTaskId) {+ queryClient.invalidateQueries({+ queryKey: ["task-relations"],+ });+ }+ } else {+ queryClient.invalidateQueries({+ queryKey: ["task", message.taskId],+ });+ }++ if (message.type === "TASK_LABEL_UPDATED") {+ queryClient.invalidateQueries({+ queryKey: ["labels", message.taskId],+ });+ }++ if (+ (message.type === "TASK_UPDATED" || message.type === "TASK_MOVED") &&+ message.taskId+ ) {+ queryClient.invalidateQueries({+ queryKey: ["external-links", message.taskId],+ });+ }++ if (message.type === "COMMENT_UPDATED") {+ queryClient.invalidateQueries({+ queryKey: ["activities", message.taskId],+ });+ queryClient.invalidateQueries({+ queryKey: ["comments", message.taskId],+ });+ }+ }function clearPing() {if (pingInterval !== null) {