shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
68.57k stars 4.06k forks source link

[bug]: Combo Box TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator)) #4252

Open AslamJM opened 1 month ago

AslamJM commented 1 month ago

Describe the bug

I copy pasted the sample combo box code in my react app the popover trigger appear. when click open this error occurred in the console.

Affected component/components

Command Combobox

How to reproduce

  1. install popover and command
  2. copy paste the sample code on the website

Codesandbox/StackBlitz link

No response

Logs

TypeError: undefined is not iterable (cannot read property Symbol(Symbol.iterator))
The above error occurred in the <ForwardRef> component:

System Info

Chrome

Before submitting

AslamJM commented 1 month ago

This is a problem with command group of cmdk library. The command list component seems to work fine

reckek commented 1 month ago

In the example, you need to add the value and onValueChange properties to the <Command /> component.

See more details here: https://github.com/pacocoursey/cmdk?tab=readme-ov-file#command-cmdk-root

verdverm commented 1 month ago

@reckek I do not believe this is the core issue, but I do believe the issue is upstream

Using this cmdk example: https://github.com/pacocoursey/cmdk?tab=readme-ov-file#use-inside-popover

You can reproduce this error by swapping List for Group

verdverm commented 1 month ago

Opened an issue upstream https://github.com/pacocoursey/cmdk/issues/284

abdullahhosenakash commented 1 month ago

I found that the problem was with the cmdk package version 1.0.0. So I removed the package using npm r cmdk and then reinstalled a lower version using npm i cmdk@^0.2.1 and it worked Alhamdulillah (all praise to Allah).