pacocoursey / cmdk

Fast, unstyled command menu React component.
https://cmdk.paco.me
MIT License
9.03k stars 258 forks source link

Sort groups in addition to items #255

Open rorhug opened 1 month ago

rorhug commented 1 month ago

The default search function is fuzzy (which makes sense #55) however the order could still be improved. In this example, maybe Figma is a good suggestion for ex but the ones containing "Extension" should definitely rank first.

image
Jamess-Lucass commented 1 month ago

I believe this is expected functionality due to the fact they are separate sections and defined by two different Command.Group components in code.https://github.com/pacocoursey/cmdk/blob/13f11c4f918cb4f7eb6254b4087a9cc83928b503/website/components/cmdk/raycast.tsx#L25-L77 I don't think ranking groups and changing their order based on the item's rank would be a good idea as I believe the intention for the group is to allow the user to define static ordering and separation.

I personally would prefer the ordering of groups I have defined in my codebase to always be in that order, upon multiple uses I believe this improves user experience as the groups are always in the same order and "place".

pacocoursey commented 1 month ago

Groups should be sorted. Not sure why they're not… will take a look!

Acring commented 1 month ago

try fix in https://github.com/pacocoursey/cmdk/pull/271