react-cmdk icon indicating copy to clipboard operation
react-cmdk copied to clipboard

Example from README is not working

Open rannn505 opened this issue 2 years ago • 20 comments

Im using create react app v5.0.1 with react v17.0.2 and getting image

rannn505 avatar Jun 14 '22 01:06 rannn505

Hi, do you mind posting a reproducible repository or a code sandbox?

albingroen avatar Jun 14 '22 04:06 albingroen

@albingroen not sure whats the difference (except sandbox is JS and local is TS) here but I couldn't reproduce it over there https://codesandbox.io/s/angry-gauss-rcz3j8?file=/src/App.js

Im not sure why I getting this error but maybe a bit of a research on what is the root cause of such an error can help us here

rannn505 avatar Jun 14 '22 13:06 rannn505

@albingroen not sure whats the difference (except sandbox is JS and local is TS) here but I couldn't reproduce it over there https://codesandbox.io/s/angry-gauss-rcz3j8?file=/src/App.js

Im not sure why I getting this error but maybe a bit of a research on what is the root cause of such an error can help us here

I think it might be a React 18 issue. The sandbox seems to be using v17. Which version are you using?

albingroen avatar Jun 14 '22 14:06 albingroen

@albingroen Getting the exact same error here on React 17.0.2. Will try to reproduce in sandbox.

honzasusek avatar Jun 14 '22 15:06 honzasusek

@albingroen Getting the exact same error here on React 17.0.2. Will try to reproduce in sandbox.

Are you using create-react-app?

albingroen avatar Jun 14 '22 16:06 albingroen

@honzasusek Yeah, version 5.0.0 + typescript 4.6.2.

honzasusek avatar Jun 14 '22 17:06 honzasusek

Im using create react app v5.0.1 with react v17.0.2 and getting image

@albingroen just mentioned it in the initial comment.

I assume that the issue comes from parts in the code that are not backward compatible with react 17 ... let us know if we can help ... and thanks 🙏🏽

rannn505 avatar Jun 14 '22 20:06 rannn505

For some weird reason, it works in codesandbox but not locally. Just tried downloading the zip and running it, but I'm running in to the same issue...

albingroen avatar Jun 14 '22 21:06 albingroen

@albingroen any progress here? do you need help?

rannn505 avatar Jun 16 '22 07:06 rannn505

@albingroen any progress here? do you need help?

Not really any progress. Would love some help!

albingroen avatar Jun 16 '22 10:06 albingroen

@albingroen Not sure if this will help, but I just copied the package contents over to our repo, fixed the imports and it seems to be running just fine like that. Could this be a build-related issue? That might explain why codesandbox is working fine with the same setup.

honzasusek avatar Jun 16 '22 15:06 honzasusek

@albingroen Not sure if this will help, but I just copied the package contents over to our repo, fixed the imports and it seems to be running just fine like that. Could this be a build-related issue? That might explain why codesandbox is working fine with the same setup.

Hmm, that sounds really weird...

albingroen avatar Jun 17 '22 06:06 albingroen

@honzasusek Do you mind putting up that repo or inviting me to it so I can see it?

albingroen avatar Jun 17 '22 16:06 albingroen

@albingroen I'm afraid that isn't possible, but I think I could at least share our tsconfig.json, package.json + a general outline of our setup over PM.

honzasusek avatar Jun 21 '22 09:06 honzasusek

@honzasusek Alright, you can DM me here

albingroen avatar Jun 21 '22 12:06 albingroen

@albingroen no twitter account, sorry, sent you an email instead 👴

honzasusek avatar Jun 22 '22 12:06 honzasusek

I was able to reproduce on a simple CRA project:

npx create-react-app my-project --template typescript
yarn add react-cmdk
yarn start

Then add the code from the readme into the app.

dutziworks avatar Jul 01 '22 13:07 dutziworks

Also, I'm adding these tags so people will find this issue easily:

Uncaught TypeError: Cannot read properties of undefined (reading 'Child')

dutziworks avatar Jul 01 '22 13:07 dutziworks

Having same issue with React 18 on local machine. It is not working and throwing

Uncaught TypeError: Cannot read properties of undefined (reading 'Child')

carbonrider avatar Jul 28 '22 09:07 carbonrider

It seems there is an ongoing discussion about React 18 and Transition component compatibility. I see react-cmdk using Transition component. Check the details here.

https://github.com/tailwindlabs/headlessui/issues/681

carbonrider avatar Jul 28 '22 09:07 carbonrider

I don't have the capacity to solve this, unfortunately, so I will close this for now :/

albingroen avatar Aug 25 '22 08:08 albingroen

facing the same issue as well, also was working on codesandbox

tanmayairbase avatar Sep 02 '22 06:09 tanmayairbase