fix(app): show folder names in file tree (#43835)

This commit is contained in:
Brendan Allan 2026-08-21 16:40:07 +08:00 committed by GitHub
parent 9be9dd737c
commit 5e77c494c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -60,7 +60,7 @@ test("expands a folder whose path has a trailing Windows separator", async ({ pa
if (path) return []
return [
{
name: "frontend",
name: "",
path: "frontend\\",
absolute: `${directory}/frontend`,
type: "directory" as const,
@ -116,6 +116,7 @@ test("expands a folder whose path has a trailing Windows separator", async ({ pa
const frontendRow = panel.locator('[data-slot="file-tree-v2-row"][data-path="frontend"]')
await expect(frontendRow).toBeVisible()
await expect(frontendRow.getByText("frontend", { exact: true })).toBeVisible()
await expect(frontendRow).toHaveAttribute("aria-expanded", "false")
await frontendRow.click()
await expect(frontendRow).toHaveAttribute("aria-expanded", "true")

View file

@ -100,7 +100,11 @@ const FileTreeNodeV2 = (
>
{local.children}
<span class="flex-1 min-w-0 text-start text-12-medium whitespace-nowrap truncate">
<bdi dir="auto">{local.node.name}</bdi>
<bdi dir="auto">
{local.node.type === "directory"
? normalizeFileTreeV2Path(local.node.path).split("/").at(-1)
: local.node.name}
</bdi>
</span>
{(() => {
const value = kind()