You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm facing a problem when working with asyn request options list and search operation. For some reason I could not understand yet, when the records are being fetched, cmdk show both Empty and Loading component at the same time (image below).
Is it a bug or am I doing something wrong?
exportconstSearch=()=>{const[open,setOpen]=React.useState(false)const[search,setSearch]=React.useState('')const{data: results, isLoading }=useQuery(['docs',search],async(context)=>{constclient=newMeiliSearch({host: 'http://127.0.0.1:7700',apiKey: 'myMasterKey'})// An index is where the documents are stored.constindex=client.index('movies')constqueryResults=awaitindex.search(context.queryKey[1],{limit: 5})returnqueryResults})return(<><buttononClick={()=>setOpen(true)}>
Search docs
</button><Command.DialogshouldFilter={false}open={open}onOpenChange={setOpen}label="Global Command Menu"><Command.Inputvalue={search}onValueChange={setSearch}/><Command.List>{isLoading&&<Command.Loading>Carregando…</Command.Loading>}{results?.hits.map((hit)=>(<Command.Itemkey={hit.id}value={hit.title}><h4>{hit.title}</h4><span>{hit.overview}</span></Command.Item>))}<Command.Empty>Nenhuma opção disponível</Command.Empty></Command.List></Command.Dialog></>)}
Waiting request to resolve:
The text was updated successfully, but these errors were encountered:
I'm facing a problem when working with asyn request options list and search operation. For some reason I could not understand yet, when the records are being fetched, cmdk show both
Empty
andLoading
component at the same time (image below).Is it a bug or am I doing something wrong?
Waiting request to resolve:
The text was updated successfully, but these errors were encountered: