mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 08:41:46 +08:00
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:
@ -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");
|
||||
});
|
||||
});
|
||||
|
||||
@ -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>
|
||||
|
||||
Reference in New Issue
Block a user