From 75efd0a2a4fa56f2bbeccac0e624e33b46076855 Mon Sep 17 00:00:00 2001 From: Eric Hare Date: Mon, 1 Jun 2026 13:50:40 -0700 Subject: [PATCH] fix: point file manager empty-state link to the files page route (#13450) The "My Files" shortcut in the file manager empty state linked to a top-level "/files" route that does not exist. The files page is nested under "assets" (routes.tsx: assets -> files), so clicking the link dead-ended instead of opening My Files. Point the link at "/assets/files", matching the sidebar navigation in sideBarFolderButtons (_navigate("/assets/files")). Add a regression test asserting the empty-state link's href. --- .../__tests__/recent-files-component.test.tsx | 21 +++++++++++++++++++ .../components/recentFilesComponent/index.tsx | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/__tests__/recent-files-component.test.tsx b/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/__tests__/recent-files-component.test.tsx index 61a1675dc9..fc041fd35b 100644 --- a/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/__tests__/recent-files-component.test.tsx +++ b/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/__tests__/recent-files-component.test.tsx @@ -1,5 +1,6 @@ import { fireEvent, render, screen } from "@testing-library/react"; import type { ComponentPropsWithoutRef, ReactNode } from "react"; +import { MemoryRouter } from "react-router-dom"; import type { FileType } from "@/types/file_management"; import { setRelativePathForServerPath } from "@/utils/file-relative-path-map"; import RecentFilesComponent from "../index"; @@ -166,4 +167,24 @@ describe("RecentFilesComponent", () => { expect(screen.getByTestId("files-renderer")).toBeInTheDocument(); }); + + it("links the empty-state 'My Files' shortcut to the /assets/files route", () => { + // Regression: the empty-state link pointed at the non-existent top-level + // "/files" route (a dead end). The files page is nested under "assets", + // so the link must target "/assets/files" — matching the sidebar's + // navigation in sideBarFolderButtons. + render( + + + , + ); + + expect(screen.getByRole("link")).toHaveAttribute("href", "/assets/files"); + }); }); diff --git a/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/index.tsx b/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/index.tsx index ea69a93ccf..470eff44f0 100644 --- a/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/index.tsx +++ b/src/frontend/src/modals/fileManagerModal/components/recentFilesComponent/index.tsx @@ -427,7 +427,7 @@ export default function RecentFilesComponent({ {t("fileManager.orVisit")}{" "} {t("files.myFiles")}.