fix(folders): show the folder trail in table and knowledge base headers - #6515
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Table and knowledge base detail pages were missing intermediate folders because they never used the resource’s
Reviewed by Cursor Bugbot for commit 1df52e0. Configure here. |
Greptile SummaryThis PR unifies breadcrumb construction across foldered resource surfaces so list and detail headers show complete folder ancestry.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| apps/sim/app/workspace/[workspaceId]/components/folders/folder-breadcrumbs.ts | Introduces shared folder-chain validation and list/detail breadcrumb construction. |
| apps/sim/app/workspace/[workspaceId]/components/folders/use-folder-ancestors.ts | Centralizes folder-tree fetching, resolution state, and ancestor derivation. |
| apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx | Adds full knowledge-base folder ancestry and guards route-leaving breadcrumbs while the chunk editor is open. |
| apps/sim/app/workspace/[workspaceId]/files/files.tsx | Replaces path-string breadcrumb reconstruction with parent-ID traversal and correct list-route navigation. |
| apps/sim/app/workspace/[workspaceId]/tables/[tableId]/table.tsx | Adds the table's folder ancestry to its detail-page header. |
| apps/sim/lib/folders/tree.ts | Provides the shared cycle-safe ancestor walk used by foldered surfaces. |
Reviews (4): Last reviewed commit: "chore(folders): tighten the shared bread..." | Re-trigger Greptile
6379114 to
e54c733
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ 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.
e54c733 to
e409ad9
Compare
|
@cursor review |
There was a problem hiding this comment.
✅ 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.
|
@cursor review |
There was a problem hiding this comment.
✅ 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.
Summary
Tables / name, dropping every folder between it and the root, while a file's header showed the fullFiles / docs / namepath. The detail pages never read the resource's ownfolderId, so the trail could not include it.folderAncestorChain(folderId, lookup)inlib/folders/tree.tsis the single upward walk. BothgetFolderPathvariants 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.folderBreadcrumbItemstakes atrailingslot for detail pages, as a discriminated union so an open-folder rename can't be passed alongside it and silently dropped.useFolderAncestorsowns the folder tree plus thefoldersResolvedstaleness rule;useFolderNavigationdelegates to it.FOLDERED_RESOURCE_HEADERSowns each resource's root label, root icon, and list path, which seven sites previously restated.pathstring, which couldn't tell two same-named siblings apart, onto the shared parentId walk.?folderId=to the open file's own URL instead of navigating to the list.Type of Change
Testing
tsc --noEmit,bun run lint:check, andbun run check:react-query/check:api-validation/check:client-boundaryall 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