46276 frontend [ datasets ] improvements to the dataset#207
46276 frontend [ datasets ] improvements to the dataset#207Maria-Lordwill wants to merge 3 commits into
Conversation
…sable empty datasets in template editor
…10 instead of 1, 10, 2)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 25431ea. Configure here.
| () => datasetsList.map((dataset) => ({ label: dataset.name, value: String(dataset.id) })), | ||
| () => datasetsList | ||
| .filter(({ itemsCount }) => itemsCount > 0) | ||
| .map(({ name, id }) => ({ label: name, value: String(id) })), |
There was a problem hiding this comment.
Empty datasets filtered out instead of shown disabled
Medium Severity
The .filter(({ itemsCount }) => itemsCount > 0) call removes datasets with zero items from the options entirely, but the PR intent is to render them as disabled (visually muted, non-clickable, with aria-disabled). Filtering contradicts the stated behavior — empty datasets become invisible rather than disabled. Additionally, if a field already references a dataset whose items were later deleted, that dataset silently disappears from the dropdown, leaving the user unable to see or change the current selection.
Reviewed by Cursor Bugbot for commit 25431ea. Configure here.


1. Release notes
2. Description (problem)
Sorting: On the dataset details page, sorting items by name produced lexicographic order for numeric values: 1, 10, 2, 20, 3. This is the default
localeComparebehavior without thenumericoption, but it is unintuitive for users.Empty datasets: In the template editor, the field hamburger menu (dropdown/checkbox/radio) allowed selecting a dataset with zero items. After saving the template, the Run form displayed such a field as empty — only the field name with no options.
3. Context
/datasets/:id— item sorting.KickoffRedux(kickoff fields) andOutputForm(task fields) — both use the shareduseDatasetOptionshook.4. Solution
Sorting: Added
{ numeric: true }option tolocaleComparefor name-based sorting — numbers within strings are now compared as numbers.Empty datasets: Added
.filter(({ itemsCount }) => itemsCount > 0)in theuseDatasetOptionshook before building the options list. TheitemsCountfield was already provided by the backend in the datasets list API response and defined in theIDatasetListItemtype, but was not previously used.5. What to test
5.1 Preconditions
5.2 Positive scenarios
5.3 Negative scenarios and edge cases
5.4 Verification points
5.5 What was NOT tested
6. Commits
01246fd7—46276 fix(datasets): use natural sort order for dataset items (1, 2, 10 instead of 1, 10, 2)25431ea9—46276 fix(datasets): hide empty datasets from selection menu in template editorNote
Cursor Bugbot is generating a summary for commit 01246fd. Configure here.
Note
Filter empty datasets and fix numeric name sorting in dataset options
useDatasetOptionsnow excludes datasets with zero items from the selectable options list.getSortedAndFilteredDatasetItemsuseslocaleComparewithnumeric: truefor name-based sorting, so values like'2'and'10'sort in natural numeric order.itemsCount === 0no longer appear as selectable options; name sort order may change for values containing numbers.Macroscope summarized 25431ea.