Next.js Discord

Discord Forum

shadcn combox issue

Answered
Mugger Crocodile posted this in #help-forum
Open in Discord
Mugger CrocodileOP
I have copy pasted the code from the docs ( https://ui.shadcn.com/docs/components/combobox#combobox )
I get this error. I do not think this issue is on my end..
"cmdk": "^1.0.0","@radix-ui/react-popover": "^1.0.7" are my package.json
Answered by Mugger Crocodile
Okay I just needed to wrap both CommandEmpty and CommandGroup into CommandList component. Now its working. Sad that shadcn documentation is wrong
View full answer

21 Replies

@B33fb0n3 are you trying to use it inside a server component?
Mugger CrocodileOP
I had that ComboboxDemo as a seperate client component and was calling that in a server component. I do not think that was the issue..
just to make sure it's really not because of servercomponent, can you import your client component like this:
const ComponentC = dynamic(() => import('../components/C'), { ssr: false })
And then load it like this
<ComponentC />
Oh and don't forget the { ssr: false }
Mugger CrocodileOP
@B33fb0n3 Pretty confused what this dynamic stuff is about..
what's the error when you hover over the red line?
@B33fb0n3 what's the error when you hover over the red line?
Mugger CrocodileOP
I just tried it without the server component, just the client component copy pasted from docs and it seems to give the same original error..
hm, I have no idea, sorry
@B33fb0n3 hm, I have no idea, sorry
Mugger CrocodileOP
Does it work on your system?
have a feeling it's from the cmdk lib
yes, it works for me
Mugger CrocodileOP
I get the original error when I click on the popover trigger.. I reinstalled the packages still the same..
Mugger CrocodileOP
@B33fb0n3 I'm running it on minimal code and the Command thing seems to be the problem
I removed the entire Command stuff and it works..
Mugger CrocodileOP
Okay I just needed to wrap both CommandEmpty and CommandGroup into CommandList component. Now its working. Sad that shadcn documentation is wrong
Answer
@Mugger Crocodile Okay I just needed to wrap both CommandEmpty and CommandGroup into CommandList component. Now its working. Sad that shadcn documentation is wrong
Happy to hear that you solved it. You might want to open a issue on github to let it solved 🙂
Mugger CrocodileOP
wokay will do