Skip to content

fix(folders): show the folder trail in table and knowledge base headers - #6515

Merged
waleedlatif1 merged 4 commits into
stagingfrom
folder-toolbar-header
Aug 11, 2026
Merged

fix(folders): show the folder trail in table and knowledge base headers#6515
waleedlatif1 merged 4 commits into
stagingfrom
folder-toolbar-header

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • A table or knowledge base opened from inside a folder rendered Tables / name, dropping every folder between it and the root, while a file's header showed the full Files / docs / name path. The detail pages never read the resource's own folderId, so the trail could not include it.
  • Rather than patch the two headers, all six foldered surfaces (Files, Tables, Knowledge — list and detail) now build their trail from one shared builder:
    • folderAncestorChain(folderId, lookup) in lib/folders/tree.ts is the single upward walk. Both getFolderPath variants delegate to it. The two lock predicates deliberately keep their inline walks — they short-circuit at the first locked ancestor on a per-row render path.
    • folderBreadcrumbItems takes a trailing slot for detail pages, as a discriminated union so an open-folder rename can't be passed alongside it and silently dropped.
    • useFolderAncestors owns the folder tree plus the foldersResolved staleness rule; useFolderNavigation delegates to it.
    • FOLDERED_RESOURCE_HEADERS owns each resource's root label, root icon, and list path, which seven sites previously restated.
  • Files' list trail moved off splitting the materialized path string, which couldn't tell two same-named siblings apart, onto the shared parentId walk.
  • Also fixes the Files loading trail, whose folder crumbs used the nuqs setter while rendering on the file detail route — appending ?folderId= to the open file's own URL instead of navigating to the list.

Type of Change

  • Bug fix

Testing

tsc --noEmit, bun run lint:check, and bun run check:react-query / check:api-validation / check:client-boundary all clean. 2902 tests across 249 files pass, including new coverage for the chain walk and the detail-page trail; I verified those tests fail against a deliberately broken implementation.

Not yet verified in a browser — the dev server won't start from a git worktree (Turbopack resolves the outer repo as root). The visual change is the folder segments now appearing in table/KB headers, so it's worth a look on the preview before merge.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercelBot commented Aug 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
ProjectDeploymentActionsUpdated (UTC)
docsSkippedSkippedAug 11, 2026 1:31am

Request Review

@cursor

cursorBot commented Aug 11, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Cross-resource header and navigation changes with shared folder-tree correctness rules (foldersResolved, partial chains); no auth or data-model changes, but regressions would show wrong paths or broken crumb navigation.

Overview
Foldered Files, Tables, and Knowledge list and detail headers now build the same trail from one path: walk parentId via folderAncestorChain, validate completeness with breadcrumbFolderChain, and assemble crumbs with folderBreadcrumbItems (list mode keeps rename/menu on the open folder; detail mode uses trailing crumbs so every folder segment navigates).

Table and knowledge base detail pages were missing intermediate folders because they never used the resource’s folderId; they now load the chain through useFolderAncestors. List navigation still uses useFolderNavigation, which delegates ancestry to that hook and exposes ancestors instead of duplicating tree fetch logic.

FOLDERED_RESOURCE_HEADERS and folderedResourceListHref / folderListHref centralize root labels, icons, and list URLs (including Recently deleted folder links). Files list breadcrumbs no longer split a materialized path string (ambiguous siblings); loading/detail folder crumbs navigate to the files list route instead of mutating the open file URL with nuqs.

Reviewed by Cursor Bugbot for commit 1df52e0. Configure here.

@greptile-apps

greptile-appsBot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR unifies breadcrumb construction across foldered resource surfaces so list and detail headers show complete folder ancestry.

  • Adds shared folder-chain, breadcrumb, navigation, and resource-header helpers.
  • Updates Files, Tables, and Knowledge surfaces to use resource folderId ancestry.
  • Routes document breadcrumb navigation through the existing unsaved-edit guard.
  • Adds coverage for ancestor traversal, incomplete trees, cycles, and detail-page trails.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

FilenameOverview
apps/sim/app/workspace/[workspaceId]/components/folders/folder-breadcrumbs.tsIntroduces shared folder-chain validation and list/detail breadcrumb construction.
apps/sim/app/workspace/[workspaceId]/components/folders/use-folder-ancestors.tsCentralizes folder-tree fetching, resolution state, and ancestor derivation.
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsxAdds full knowledge-base folder ancestry and guards route-leaving breadcrumbs while the chunk editor is open.
apps/sim/app/workspace/[workspaceId]/files/files.tsxReplaces path-string breadcrumb reconstruction with parent-ID traversal and correct list-route navigation.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsxAdds the table's folder ancestry to its detail-page header.
apps/sim/lib/folders/tree.tsProvides the shared cycle-safe ancestor walk used by foldered surfaces.

Reviews (4): Last reviewed commit: "chore(folders): tighten the shared bread..." | Re-trigger Greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e54c733. Configure here.

A table or knowledge base opened from inside a folder rendered `Tables / name`,
dropping every folder between it and the root — while a file's header showed the
full `Files / docs / name` path. The detail pages never read the resource's own
`folderId`, so the trail could not include it.
Converge all six foldered surfaces on one builder instead of fixing the two
headers in place:
- `folderAncestorChain(folderId, lookup)` in `lib/folders/tree.ts` is now the
single upward walk. Both `getFolderPath` variants delegate to it; the two lock
predicates deliberately keep their inline walks, which short-circuit at the
first locked ancestor on a per-row render path.
- `folderBreadcrumbItems` takes a `trailing` slot for detail pages, as a
discriminated union so an open-folder rename cannot be passed alongside it and
silently dropped.
- `useFolderAncestors` owns the tree plus the `foldersResolved` staleness rule;
`useFolderNavigation` now delegates to it.
- `FOLDERED_RESOURCE_HEADERS` owns each resource's root label, root icon, and
list path, which seven sites previously restated.
Files' list trail moved off splitting the materialized `path` string, which
could not tell two same-named siblings apart, onto the shared parentId walk.
Also fixes the Files loading trail, whose folder crumbs used the nuqs setter
while rendering on the file detail route — appending `?folderId=` to the open
file's own URL instead of navigating to the list.
@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit e409ad9. Configure here.

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@greptile

@waleedlatif1

Copy link
Copy Markdown
CollaboratorAuthor

@cursor review

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1df52e0. Configure here.

@waleedlatif1
waleedlatif1 merged commit fff6606 into stagingAug 11, 2026
30 checks passed
@waleedlatif1
waleedlatif1 deleted the folder-toolbar-header branch August 11, 2026 01:38
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@waleedlatif1