ui
ui copied to clipboard
(BUG) Handling empty state for searching in <Command />
Description
- Once you search for an item which is not there in the displayed list, it will display the
<CommandEmpty />content. - But when we backspace and start writing the correct item name, the
<CommandEmpty />content is still being displayed even though there are items. - I have to clear my query and then start typing again.
Steps to reproduce
- Start typing something with a letter which is there in the item and then type something else, such that it shows 'No results found'.
- Then backspace and type the correct item name.
- The items will not be displayed even though there are items matching the query.
I found this issue, but it has some different behaviors depending on the options you have in your options list.
- Search Works perfectly when i have a list where both the label and value are the same, both of type String.
- but with the value is a number, it has different behaviors, i tried to put my own search method, the difference is that sometimes the backspace triggers the execution, and sometimes it doesn't.
i hope it can be fixed soon.
I found this issue, but it has some different behaviors depending on the options you have in your options list.
- Search Works perfectly when i have a list where both the label and value are the same, both of type String.
- but with the value is a number, it has different behaviors, i tried to put my own search method, the difference is that sometimes the backspace triggers the execution, and sometimes it doesn't.
i hope it can be fixed soon.
it was fixed when i changed the value in CommandItem to item.lable instead of item.value
<CommandItem ...restOfProps value={item.label} > {item.label} </CommandItem>
I was able to reproduce in https://ui.shadcn.com/docs/components/command
Also happens if you type something which is not there, and then select everything and start typing the correct work (without using backspace).
Yet it works in https://cmdk.paco.me/
Related with #1754
Duplicate of #1450
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.