useSelect local search
i dont want to make api call when users type in search input
4 Replies
Hi @dreamer9067. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
If you want to perform client-side filtering instead of making an API call every time a user types in the search input, you can achieve this by passing the
onSearch
function as undefined
. This will disable the server-side filtering and will filter the options on the client-side. Here is an example of how you can do this:
In this example, the onSearch
function is set to undefined
, which disables server-side filtering. The searchValue
and onSearchChange
properties are used to enable the search input.
For more details, you can refer to the refine documentation (https://refine.dev/docs/api-reference/mantine/hooks/useSelect).
If you want to delay the search until the user finishes typing, you can use the React Transition API. This allows you to prioritize one event over another. For instance, you can show the user what they are entering but wait to start the search until the user finishes typing. Here is an example:
For more details, you can refer to the refine blog post (https://refine.dev/blog/react-suspense-guide) on React Suspense and Transitions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again
:speech_balloon:
----------------------<@560876002046377984> kapa.ai is still learning and improving, please let us know how it did by reacting below
multiple-amethyst•2y ago
Hello @dreamer9067 , bot seems right
metropolitan-bronzeOP•2y ago
yep
thanks