Using RQ with MultipleSelector component in Async
I am using this component and it's set up like this currently...
So:
1. User enters a search term in the
<MultiSelect>
, which changes the SearchTerm
state variable
2. The change in SearchTerm
triggers RQ, which queries for a list of Items
3. The memo'd itemOptions
are calculated
4. The <MultiSelect>
updates with the latest options to select from
However, by using onSearchSync
, there's no loading indicator displayed. I'm dont understand how to use both RQ (for caching) and this component in its async config.shadcn/ui expansions
shadcn/ui expansions collect lots of useful components which shadcn/ui does not have out of box. All the components are base on shadcn/ui. Just copy and paste. The component is yours.
2 Replies
equal-aqua•2mo ago
Someone will correct me if I'm wrong -- but you probably need to use
queryClient.fetchQuery
for you to get a promise and then pass it to onSearchAsync
https://tanstack.com/query/v5/docs/reference/QueryClient#queryclientfetchqueryxenial-blackOP•2mo ago
I think you're exactly right with that recommendation. Here's how the code was modified and appears to be working just fine:
It's quite a bit cleaner, I think. Thanks!