Skip to content

Commit 893f6fd

Browse files
Simplify popular commands sorting logic
Refactored the sorting function for 'popular' commands to sort directly by popularityRank, as all commands now have this property. Removed redundant checks for the 'popular' flag.
1 parent dbee211 commit 893f6fd

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

static/js/commands-page.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,14 +348,8 @@ class CommandsBrowser {
348348
case 'popular':
349349
sorted.sort((a, b) => {
350350
// Sort by popularityRank (lower rank = more popular)
351-
if (a.popular && b.popular) {
352-
return a.popularityRank - b.popularityRank;
353-
}
354-
// Popular commands come first
355-
if (a.popular && !b.popular) return -1;
356-
if (!a.popular && b.popular) return 1;
357-
// Both non-popular, sort alphabetically
358-
return a.name.localeCompare(b.name);
351+
// All commands have a popularityRank, so sort by it directly
352+
return a.popularityRank - b.popularityRank;
359353
});
360354
break;
361355

0 commit comments

Comments
 (0)