Skip to content

feat(search): add tables, files, knowledge bases, and jobs to cmd-k search#3800

Merged
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/cmdk-search-scope
Mar 27, 2026
Merged

feat(search): add tables, files, knowledge bases, and jobs to cmd-k search#3800
waleedlatif1 merged 4 commits intostagingfrom
waleedlatif1/cmdk-search-scope

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Add individual tables, files, knowledge bases, and jobs as searchable entities in the cmd-k search modal
  • Previously these only appeared as static navigation links to their list pages
  • Uses existing React Query hooks (deduplicated by React Query) to fetch entity data
  • Respects permission config (hideTablesTab, hideFilesTab, hideKnowledgeBaseTab)
  • Generic MemoizedIconItem and createIconGroup factory to avoid copy-paste

Type of Change

  • New feature

Testing

Tested manually

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
Copy link

vercel bot commented Mar 27, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Mar 27, 2026 2:18am

Request Review

@cursor
Copy link

cursor bot commented Mar 27, 2026

PR Summary

Medium Risk
Moderate risk: adds new React Query fetches in Sidebar and new result groups in the cmd-k modal, which could impact performance or permissions/visibility if misconfigured, but stays within client-side navigation/search UI.

Overview
Expands the cmd-k search modal to include individual tables, files, and knowledgeBases as selectable results that navigate directly to the entity page.

Sidebar now fetches these entity lists via existing query hooks and passes them into SearchModal, respecting hideTablesTab, hideFilesTab, and hideKnowledgeBaseTab. The search UI adds a reusable MemoizedIconItem plus an icon-group factory (createIconGroup) to render the new result sections.

Written by Cursor Bugbot for commit 2100c85. Configure here.

@waleedlatif1 waleedlatif1 force-pushed the waleedlatif1/cmdk-search-scope branch from f5936ee to 4d0f7f0 Compare March 27, 2026 01:53
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 27, 2026

Greptile Summary

This PR extends the cmd-k search modal to surface individual tables, files, and knowledge bases as navigable search results, complementing the existing static "Pages" links. It introduces a MemoizedIconItem component and a createIconGroup factory to avoid repetition, fetches entity data via three existing React Query hooks in Sidebar, respects per-entity permission flags, and maps each entity to a valid deep-link href.\n\nKey changes:\n- command-items.tsx: New MemoizedIconItem memoized component with a four-field custom comparator (including onSelect, fixed from prior review).\n- search-groups.tsx: createIconGroup factory produces three exported group components (TablesGroup, FilesGroup, KnowledgeBasesGroup) with minimal duplication.\n- search-modal.tsx: Three new filteredX memos and the three new group components wired in; reuses the existing handleTaskSelect callback since the navigation behaviour is identical to tasks.\n- sidebar.tsx: Calls useTablesList, useWorkspaceFiles, and useKnowledgeBasesQuery; maps results to TaskItem with entity-specific hrefs (individual file routes at [fileId]/page.tsx confirmed to exist).\n- Jobs and files with ambiguous routing (original concern from prior review) have been addressed: jobs are absent and files now carry per-file deep-link hrefs.

Confidence Score: 5/5

Safe to merge — prior routing concerns are resolved, logic is correct, and the single remaining note is a non-blocking style preference.

All prior review concerns have been addressed: the onSelect comparator was added to MemoizedIconItem, jobs were removed (no per-job routes exist), and files now carry valid individual deep-link hrefs that map to an existing [fileId]/page.tsx route. The only open item is a minor style issue (factory defined after its callers due to hoisting), which does not affect correctness or reliability.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/_components/command-items.tsx Adds MemoizedIconItem — a generic memoized command item with an icon. Comparator correctly includes all four props including onSelect (addressed from prior review).
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/_components/search-groups.tsx Introduces createIconGroup factory and exports TablesGroup, FilesGroup, KnowledgeBasesGroup. Minor style issue: factory function is called before it is defined in the file (function hoisting makes it work, but it's unusual).
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/search-modal.tsx Wires the three new groups with filteredX memos derived from filterAndSort. Reuses handleTaskSelect appropriately since the navigation behaviour is identical.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/utils.ts Adds three optional TaskItem[] props to SearchModalProps — clean, no issues.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/sidebar.tsx Fetches tables, files, and knowledge bases via existing React Query hooks; maps them to TaskItem with valid deep-link hrefs; respects permission config flags.

Reviews (2): Last reviewed commit: "fix(search): add files back with per-fil..." | Re-trigger Greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@waleedlatif1 waleedlatif1 merged commit e70e1ec into staging Mar 27, 2026
6 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/cmdk-search-scope branch March 27, 2026 02:18
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