Skip to content

fix(chat): show table and knowledge base folders in the resource menus - #6190

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/resource-menu-folder-structure
Aug 2, 2026
Merged

fix(chat): show table and knowledge base folders in the resource menus#6190
waleedlatif1 merged 1 commit into
stagingfrom
fix/resource-menu-folder-structure

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Tables and knowledge bases have folders now, but the chat attachment menu (+ / @) and the embedded resource menu still listed them flat — both now show the same hierarchy as the Tables and Knowledge pages
  • Collapsed the two near-duplicate workflow/file tree builders + renderers into one shared buildResourceFolderTree / ResourceFolderTreeItems / ResourceTreeSections, so all four foldered families (workflows, files, tables, KBs) go through one code path
  • A single FOLDERED_SECTION_SPECS table now drives display order, folder source, ordering, and folder selectability — the skip-set is derived from it, so a new family can't be added in one place and missed in the other (which would render it twice)
  • Side effect of the unification: items whose folder no longer resolves surface at the root instead of silently vanishing (this was a latent bug in the Files submenu)
  • Table/KB folders are structure only, not attachable resources — making them attachable needs resource-policy, invalidator, and copilot VFS support, so it's deliberately out of scope

Type of Change

  • Bug fix

Testing

  • 10 unit tests for the shared tree builder; mutation-checked that each can actually fail (broke orphan-healing → 2 red, pruning → 1 red, sort ordering → 3 red)
  • tsc -p apps/sim clean, bun run lint:check clean
  • Not yet verified in a running app

Notes / follow-ups (not in this PR)

  • Cmd-K search modal builds table/KB rows without folderPath, while workflows and files include it — the receiving UI already renders the breadcrumb
  • The table and knowledge-base selectors in workflow blocks are still flat comboboxes; two tables named the same in different folders are indistinguishable
  • Copilot VFS asserts tables/ and knowledgebases/ are flat namespaces — that's the reason the "not attachable" call above is a deferral rather than a resolution
  • The viewport clamp on the chat menu's submenus (calc(100vw-32px)) arguably belongs in emcn's DropdownMenuSubContent for every submenu, not as a consumer override

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)

Tables and knowledge bases gained folder support, but the chat attachment
menu and the embedded resource menu still listed them flat. Both now render
the same hierarchy the Tables and Knowledge pages show.

Unifies the two near-duplicate workflow/file tree builders into one shared
buildResourceFolderTree plus a spec-driven useResourceTreeSections, so all
four foldered families go through one code path. Items whose folder no
longer resolves now surface at the root instead of vanishing.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 2, 2026 5:55am

Request Review

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
UI-only browse-menu refactor with no auth or persistence changes; risk is mainly regressions in workflow/file picker behavior, mitigated by shared builder tests and unchanged attach/select handlers.

Overview
The chat + / @ attachment menus and the mothership Add resource dropdown now show tables and knowledge bases in the same folder hierarchy as the Tables and Knowledge pages, instead of flat lists.

Duplicate workflow/file tree logic is replaced by a shared buildResourceFolderTree plus ResourceFolderTreeItems / ResourceTreeSections, driven by FOLDERED_SECTION_SPECS so workflows, files, tables, and KBs share one code path and FOLDERED_RESOURCE_TYPES stays aligned with what the submenus render. Table/KB folder metadata is loaded via typed useFolders calls into structureFolders (not attachable, so omitted from flat search). Hydration gating intentionally ignores those folder fetches so @-mention Enter is not blocked on extra round-trips.

Items whose folder no longer exists surface at the root instead of disappearing (including a latent files-menu case). Ten unit tests cover nesting, orphan healing, pruning, sort order, and parent cycles.

Reviewed by Cursor Bugbot for commit 48f1da4. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds folder-aware table and knowledge-base browsing to both resource menus while consolidating all foldered resource families onto a shared tree builder and renderer.

  • Adds generic hierarchy construction with orphan recovery, recursive pruning, and optional manual ordering.
  • Introduces declarative foldered-section specifications shared by the embedded resource dropdown and chat attachment menu.
  • Adds focused unit coverage for hierarchy, ordering, pruning, orphan, and cycle behavior.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete changed-code defect identified.

The shared hierarchy preserves existing rendering and selection contracts, handles unresolved parents safely, updates reactively as folder queries resolve, and is exercised by focused tree-builder tests.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown/add-resource-dropdown.tsx Consolidates foldered resource fetching, section construction, rendering, and flat-list suppression without an identified contract break.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown/resource-folder-tree.ts Adds a generic deterministic tree builder with orphan recovery, empty-folder pruning, and optional sort-order handling.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown/resource-folder-tree.test.ts Covers the shared builder’s nesting, source preservation, orphan, pruning, ordering, and cycle behavior.
apps/sim/app/workspace/[workspaceId]/home/components/user-input/components/plus-menu-dropdown/plus-menu-dropdown.tsx Replaces duplicated workflow and file rendering with shared foldered sections, adding table and knowledge-base hierarchy support.
apps/sim/app/workspace/[workspaceId]/home/components/mothership-view/components/add-resource-dropdown/index.ts Updates the module’s public exports to expose the shared tree-section APIs.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Resources[Resource groups] --> Specs[FOLDERED_SECTION_SPECS]
  Folders[Workflow, file, table, and KB folders] --> Specs
  Specs --> Builder[buildResourceFolderTree]
  Builder --> Sections[ResourceTreeSections]
  Sections --> Embedded[Embedded resource dropdown]
  Sections --> Chat[Chat attachment and mention menu]
Loading

Reviews (1): Last reviewed commit: "fix(chat): show table and knowledge base..." | Re-trigger Greptile

@waleedlatif1
waleedlatif1 merged commit f113b0b into staging Aug 2, 2026
19 of 21 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/resource-menu-folder-structure branch August 2, 2026 06:03
Sign up for free to 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