⚡ 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): center Gantt after filtered project becomes visible
Tin010c72c9a551
diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.test.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.test.tsxindex b5bf1ab6b..be34b0925 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.test.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.test.tsx@@ -147,6 +147,35 @@ afterEach(() => {});describe("Gantt jump-to-today", () => {+ it("centers a new project after a search stops hiding its timeline", () => {+ mockProjectWithTask(+ makeTask({+ title: "First task",+ startDate: "2026-08-28",+ dueDate: "2026-09-02",+ }),+ );+ const { rerender } = render(<GanttRoute />);+ const search = screen.getByPlaceholderText("Search scheduled tickets...");+ fireEvent.change(search, { target: { value: "no match" } });+ routeParams.projectId = "project-2";+ mockProjectWithTask(+ makeTask({+ title: "Second task",+ startDate: "2026-08-28",+ dueDate: "2026-09-02",+ }),+ { id: "project-2" },+ );+ rerender(<GanttRoute />);++ fireEvent.change(search, { target: { value: "" } });++ expect(scrollIntoView).toHaveBeenCalledTimes(2);+ expect(scrollIntoView).toHaveBeenLastCalledWith(+ expect.objectContaining({ behavior: "auto", inline: "center" }),+ );+ });it("disables the button and never auto-scrolls when no task falls near today", () => {mockProjectWithTask(makeTask({diff --git a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.tsx b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.tsxindex dfdae289e..40fffb607 100644--- a/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.tsx+++ b/apps/web/src/routes/_layout/_authenticated/dashboard/workspace/$workspaceId/project/$projectId/gantt.tsx@@ -236,10 +236,16 @@ function RouteComponent() {// its auto-center.// biome-ignore lint/correctness/useExhaustiveDependencies: projectId is intentionally listed to force a re-run on project switch; see comment above.useLayoutEffect(() => {- if (hasCenteredOnTodayRef.current || !todayInRange) return;+ if (+ hasCenteredOnTodayRef.current ||+ !todayInRange ||+ scheduledTasks.length === 0 ||+ !todayCellRef.current+ )+ return;hasCenteredOnTodayRef.current = true;scrollToToday("auto");- }, [todayInRange, scrollToToday, projectId]);+ }, [todayInRange, scrollToToday, projectId, scheduledTasks.length]);return (<ProjectLayout