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.
This commit is contained in:
Eric Hare
2026-06-01 13:50:40 -07:00
committed by GitHub
parent e2d17a6d84
commit 75efd0a2a4
2 changed files with 22 additions and 1 deletions

View File

@ -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(
<MemoryRouter>
<RecentFilesComponent
files={[]}
selectedFiles={[]}
setSelectedFiles={jest.fn()}
types={["txt"]}
isList={true}
/>
</MemoryRouter>,
);
expect(screen.getByRole("link")).toHaveAttribute("href", "/assets/files");
});
});

View File

@ -427,7 +427,7 @@ export default function RecentFilesComponent({
{t("fileManager.orVisit")}{" "}
<CustomLink
className="text-accent-pink-foreground underline"
to="/files"
to="/assets/files"
>
{t("files.myFiles")}.
</CustomLink>