Skip to content

Commit

Permalink
fix: items sort by not working (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
pengx17 authored Jan 30, 2024
1 parent 58110a0 commit f4049e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmdk/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,8 @@ const Command = React.forwardRef<HTMLDivElement, CommandProps>((props, forwarded
// Sort the items
getValidItems()
.sort((a, b) => {
const valueA = a.getAttribute(VALUE_ATTR)
const valueB = b.getAttribute(VALUE_ATTR)
const valueA = a.getAttribute('id')
const valueB = b.getAttribute('id')
return (scores.get(valueB) ?? 0) - (scores.get(valueA) ?? 0)
})
.forEach((item) => {
Expand Down

0 comments on commit f4049e6

Please sign in to comment.