ui: I can't use the combobox
I followed the instructions of the docs, added popover and command and tries to use combobox.
Whenever I click on “Select a framework”, the application fails.
index.mjs:1 Uncaught TypeError: Cannot read properties of undefined (reading 'subscribe')
at T (webpack-internal:///(app-client)/../../node_modules/cmdk/dist/index.mjs:18:10971)
at eval (webpack-internal:///(app-client)/../../node_modules/cmdk/dist/index.mjs:18:7415)
at renderWithHooks (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:10649:18)
at updateForwardRef (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:14689:20)
at beginWork$1 (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:17381:16)
at HTMLUnknownElement.callCallback (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:19449:14)
at Object.invokeGuardedCallbackImpl (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:19498:16)
at invokeGuardedCallback (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:19573:29)
at beginWork (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:25694:7)
at performUnitOfWork (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:24523:12)
at workLoopSync (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:24239:5)
at renderRootSync (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:24204:7)
at performSyncWorkOnRoot (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:23699:20)
at flushSyncWorkAcrossRoots_impl (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:9966:13)
at flushSyncWorkOnAllRoots (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:9924:3)
at processRootScheduleInMicrotask (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:10068:3)
at eval (webpack-internal:///(app-client)/../../node_modules/next/dist/compiled/react-dom/cjs/react-dom.development.js:10239:7)
About this issue
- Original URL
- State: open
- Created a year ago
- Reactions: 6
- Comments: 26
have you checked the import?, i faced the similar error because I imported
Commandfromlucide-reactCombobox stopped working with a same kind of error. Imports are correct.
Okay, found it. Package
cmdkhad a breaking change (v1.0.0) Follow the update instructions here: https://github.com/pacocoursey/cmdk/releases/tag/v1.0.0It appears that changing the CSS selector in the CommandItem className solves the problem: Before:
...data-[disabled]:pointer-events-none data-[disabled]:opacity-50After:... data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50i am unable to select the options in combo box
The CommandItem is disabled because of the [aria-disabled] CSS Selector in the className. As I mentioned earlier, I had the same issue. The disabled state is set to
truedue to the breaking changes incmdkversion 1.0.0 (https://github.com/pacocoursey/cmdk/releases/tag/v1.0.0)Change:
to
at least that is, what helped me for this issue
To fix error at MultiSelect component, please downgrade version of “cmdk” with the command “npm install cmdk@0.2.1”. Thank you
@shadcn , this issue should be closed because the solution as @sotatek-vuong mentioned is importing Command from
ui/commandinstead oflucide-react.Thanks you saved me.
Thank you so such man. I was thinking that, “Maybe, I did something wrong.”
https://github.com/shadcn-ui/ui/issues/2980#issuecomment-2029267475
this solution helped me
@tomavanc Would love to know if you’ve any working example for this? I’ve added
CommandList, just want to see a good example using CSS Selectors