feat(resources): add sort and filter to all resource list pages#3834
feat(resources): add sort and filter to all resource list pages#3834waleedlatif1 merged 30 commits intostagingfrom
Conversation
- Replace popover filter with persistent inline panel below toolbar - Add AND/OR toggle between filter rules (shown in Where label slot) - Sync filter panel state from applied filter on open - Show filter button active state when filter is applied or panel is open - Use readable operator labels matching dropdown options - Add Clear filters button (shown only when filter is active) - Close filter panel when last rule is removed via X - Fix empty gap rows appearing in filtered results by skipping position gap rendering when filter is active - Add toggle mode to ResourceOptionsBar for inline panel pattern - Memoize FilterRuleRow for perf, fix filterTags key collision, remove dead filterActiveCount prop
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates Extends the knowledge chunks API ( Written by Cursor Bugbot for commit f8a26a3. Configure here. |
Greptile SummaryThis PR consistently upgrades all resource list pages (Files, Tables, Knowledge Bases, Scheduled Tasks, Logs, Recently Deleted, KB Documents, Doc Chunks) with a sort control and Combobox-based multi-select filter panel. It also brings along several quality fixes: replacing ad-hoc debounce timers with Key changes:
The only meaningful limitation is that the Logs sort is client-side over already-fetched paginated data, which the author explicitly acknowledges in the PR description. Confidence Score: 5/5Safe to merge — all remaining findings are P2 style suggestions with no correctness or data-integrity impact. No P0/P1 issues found. The sort and filter logic is implemented consistently and correctly across all pages. Server-side sort for chunks is correctly plumbed through the API route, Zod schema, and Drizzle query. The known client-side-only sort on paginated Logs is an intentional, documented trade-off. All bug fixes in the PR (stale deps, missing uploadFile/uploadCsv in callbacks) are correct. Only three P2 style observations remain: the globals.css addition (justified by whitelabeling needs), the log-sort UX note (already documented), and the minor placement of SidebarTooltip in the main sidebar file. No files require special attention. The globals.css addition warrants a brief discussion but is technically justified. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User Input] --> B{Input Type}
B -->|Search text| C[setInputValue / setSearchTerm]
B -->|Filter selection| D[setTypeFilter / setSizeFilter / setOwnerFilter]
B -->|Sort selection| E[setActiveSort]
C --> F[useDebounce 200-300ms]
F --> G[debouncedSearchTerm]
G --> H[processedItems / filteredFiles useMemo]
D --> H
E --> H
H --> I{Sort Strategy}
I -->|Files / Tables / KB / Scheduled| J[Client-side filter + sort over full local dataset]
I -->|Logs| K[Client-side sort over currently loaded pages]
I -->|KB Documents| L[Server-side sort + filter via API query params]
I -->|Doc Chunks| M[Server-side sort + filter via API query params]
J --> N[rows ResourceRow array]
K --> N
L --> N
M --> N
N --> O[Resource component renders list]
O --> P[SortConfig to ResourceOptionsBar]
O --> Q[filterContent JSX to Popover]
O --> R[filterTags as chip row]
Reviews (6): Last reviewed commit: "pr fixes" | Re-trigger Greptile |
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-filter/table-filter.tsx
Show resolved
Hide resolved
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-filter/table-filter.tsx
Outdated
Show resolved
Hide resolved
…backs Reading rules via ref instead of closure eliminates rules from useCallback dependency arrays, keeping callbacks stable across rule edits and preserving the memo() benefit on FilterRuleRow.
…width - Remove non-TSDoc comment from table-filter (rulesRef pattern is self-evident) - Simplify SearchSection: remove setState-during-render anti-pattern; controlled input binds directly to search.value/onChange (simpler and correct) - Reduce KB filter popover from w-[320px] to w-[200px]; tag filter uses vertical layout so narrow width works; Status-only case is now appropriately compact
|
@greptile |
|
@cursor review |
Sort dropdown: name, documents, tokens, created, last updated — pre-sorted externally before passing rows to Resource. Active sort highlights the Sort button; clear resets to default (created desc). Filter popover: filter by connector status (All / With connectors / Without connectors). Active filter shown as a removable tag in the toolbar.
apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx
Outdated
Show resolved
Hide resolved
…e hook and use type guards for file filtering
|
@greptile |
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx
Outdated
Show resolved
Hide resolved
Chunk sort was previously done client-side on a single page of server-paginated data, which only reordered the current page. Now sort params (sortBy, sortOrder) flow through the full stack: types → service → API route → query hook → useDocumentChunks → document.tsx.
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx
Show resolved
Hide resolved
Resource is wrapped in React.memo, so an unstable filterContent reference on every parent re-render defeats the memo. Wrap filterContent in useMemo with correct deps in all 6 pages (files, tables, scheduled-tasks, knowledge, base, document).
Every column visible in a resource table should be sortable. Three pages had visible columns with no sort support: - files.tsx: add 'owner' sort (member name lookup) - scheduled-tasks.tsx: add 'schedule' sort (localeCompare on description) - knowledge.tsx: add 'connectors' (count) and 'owner' (member name) sorts Also add 'members' to processedKBs deps in knowledge.tsx since owner sort now reads member names inside the memo.
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
|
@greptile |
|
@cursor review |
apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/document.tsx
Show resolved
Hide resolved
|
@greptile |
|
@cursor review |
Summary
Type of Change
Testing
Tested manually
Checklist