consistently sort class names (#22415)

keep None at the bottom
This commit is contained in:
Josh Hawkins 2026-03-13 08:05:56 -05:00 committed by GitHub
parent f29ee53fb4
commit 614a6b39d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 81 additions and 69 deletions

View File

@ -125,7 +125,13 @@ export default function ClassificationSelectionDialog({
isMobile && "gap-2 pb-4", isMobile && "gap-2 pb-4",
)} )}
> >
{classes.sort().map((category) => ( {classes
.sort((a, b) => {
if (a === "none") return 1;
if (b === "none") return -1;
return a.localeCompare(b);
})
.map((category) => (
<SelectorItem <SelectorItem
key={category} key={category}
className="flex cursor-pointer gap-2 smart-capitalize" className="flex cursor-pointer gap-2 smart-capitalize"

View File

@ -700,7 +700,13 @@ function LibrarySelector({
</div> </div>
</> </>
)} )}
{Object.keys(dataset).map((id) => ( {Object.keys(dataset)
.sort((a, b) => {
if (a === "none") return 1;
if (b === "none") return -1;
return a.localeCompare(b);
})
.map((id) => (
<DropdownMenuItem <DropdownMenuItem
key={id} key={id}
className="group flex items-center justify-between" className="group flex items-center justify-between"