Open AmoonPod opened 1 week ago
searchFilter
is invoked when you type at least 1 character, otherwise, all values will be displayed (the searchFilter wont be called).
I see that you are handling your own search handling. searchFilter
should not be used to detect whether the query has changed, it is used to compute items search/indexing score (the highest score will be displayed first), calling the fetch method inside searchFilter
will cause the fetch method to be invoked many times depending on how many select value items you have.
Select does not have onSearch
method atm, but I can add it.
Yeah, it would be great to have a onSearch method. The thing is that in my code the searchFilter is not invoked anymore whenever I search for something that makes the children be empty.
Description
There seems to be a state issue with the Select widget in the ShadCN package when handling search queries. Specifically, when a search query returns no results (i.e., no children are displayed), clearing the search query does not cause the Select widget to rebuild and display the children again. The children remain invisible, even though the query has been cleared from the input.
Steps to Reproduce
Issue
The children remain hidden, even though the search query is empty, and the children should be visible again.
Expected Behavior
After clearing the search query, the Select widget should rebuild and display the list of children again.
Actual Behavior
The children remain hidden even after clearing the search query. The widget does not rebuild to reflect the current state where no search query is applied.
Example Code
Additional Information
This issue affects the user experience when searching through the list of options. It prevents users from seeing the available options again after clearing the search query, forcing them to close and reopen the Select widget to refresh the list.
Workaround
Currently, the only workaround is to close and reopen the Select widget to refresh the list of children after the search query is cleared.
There seems to be a similar issue reported earlier, where the Select widget does not reflect real-time updates when children are dynamically added, but it's already been solved.