Feat: The dataset-level tree view supports search. - #18138
Conversation
📝 WalkthroughWalkthroughThe dataset compilation navigation now supports keyword search. The input is debounced for 500 milliseconds, passed through the navigation hooks, and sent as an optional query parameter to the dataset navigation service. ChangesDataset navigation keyword search
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SearchInput
participant useCompilationNav
participant useFetchDatasetNav
participant datasetNavService
SearchInput->>useCompilationNav: input keyword change
useCompilationNav->>useFetchDatasetNav: debounced keywords
useFetchDatasetNav->>datasetNavService: getNav with keywords
datasetNavService->>datasetNavService: send keywords as query parameter
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/src/pages/dataset/compilation/hooks/use-compilation-nav.ts`:
- Around line 132-137: Update handleKeywordsChange to clear selectedNode
whenever the search input changes, while preserving the existing keywords
update. Use the selectedNode state setter already used by the surrounding
compilation navigation flow so NavTreeView cannot retain a node excluded by the
new filter.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e8a46874-5d8b-41b8-afcd-92853b208434
📒 Files selected for processing (5)
web/src/hooks/use-dataset-nav-request.tsweb/src/pages/dataset/compilation/hooks/use-compilation-nav.tsweb/src/pages/dataset/compilation/nav-tree-left-panel.tsxweb/src/pages/dataset/compilation/nav-tree-view.tsxweb/src/services/dataset-nav-service.ts
| const handleKeywordsChange = useCallback( | ||
| (e: React.ChangeEvent<HTMLInputElement>) => { | ||
| setKeywords(e.target.value); | ||
| }, | ||
| [], | ||
| ); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Clear the selected node when the search changes.
handleKeywordsChange updates keywords but leaves selectedNode unchanged. When the filtered request excludes the selected node, NavTreeView still renders the old details on the right.
Clear the selection here, or reconcile it with the new navList.
Proposed fix
(e: React.ChangeEvent<HTMLInputElement>) => {
setKeywords(e.target.value);
+ setSelectedNode(null);
},📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const handleKeywordsChange = useCallback( | |
| (e: React.ChangeEvent<HTMLInputElement>) => { | |
| setKeywords(e.target.value); | |
| }, | |
| [], | |
| ); | |
| const handleKeywordsChange = useCallback( | |
| (e: React.ChangeEvent<HTMLInputElement>) => { | |
| setKeywords(e.target.value); | |
| setSelectedNode(null); | |
| }, | |
| [], | |
| ); |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@web/src/pages/dataset/compilation/hooks/use-compilation-nav.ts` around lines
132 - 137, Update handleKeywordsChange to clear selectedNode whenever the search
input changes, while preserving the existing keywords update. Use the
selectedNode state setter already used by the surrounding compilation navigation
flow so NavTreeView cannot retain a node excluded by the new filter.
wangq8
left a comment
There was a problem hiding this comment.
Nice feature! The search implementation is clean:
- Proper debouncing (500ms) via ahooks
useDebounce - Query key includes keywords so cache invalidation works correctly
trimfrom lodash handles whitespace nicely- Props threading through the component tree is consistent
One small note: in dataset-nav-service.ts, params: { keywords: params.keywords || undefined } — make sure the backend API handles missing/empty keywords gracefully (returns unfiltered results). If it already does, this is good to go. LGTM overall.
Summary
Feat: The dataset-level tree view supports search.