Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Error: Uncaught [Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. Check the render method of ForwardRef.] #329

Closed
2 of 6 tasks
hatajoe opened this issue Aug 9, 2024 · 4 comments · Fixed by #331
Assignees
Labels
Bug Something isn't working

Comments

@hatajoe
Copy link

hatajoe commented Aug 9, 2024

Description

When I run yarn jest, I expected pass the test to happen but the above error happened instead.
This error happens in v4.9.0 or greater, but it doesn't happen in v4.8.0.

Do you have any ideas to solve this?

chakra-react-select Version

4.9.0

Link to Reproduction

https://codesandbox.io/p/devbox/yhhghw

TypeScript?

  • Yes I use TypeScript

Steps to reproduce

  1. Go to https://codesandbox.io/p/devbox/yhhghw
  2. Click on New Terminal
  3. type yarn jest and hit return key
  4. See error

Operating System

  • macOS
  • Windows
  • Linux
  • iOS/iPadOS
  • Android

Additional Information

No response

@hatajoe hatajoe added the Bug Something isn't working label Aug 9, 2024
@mareksuscak
Copy link

Facing the same issue here and it's also only happening in a test environment (coincidentally also using Jest). Our Jest currently doesn't support Pure ESM modules and it seems that version 4.9.0 switched this module to ESM only or at least made related changes to the package.json - see v4.8.0...v4.9.1

@csandman
Copy link
Owner

csandman commented Sep 3, 2024

I see, yeah v4.9.0/v4.9.1 updated the package to make ESM work properly, where as before that it was kind of "fake" ESM, but this package still has a CommonJS version. You can see more info about it in my PR description for 4.9.0. If this is causing the issue, it should be possible to force jest to get the CJS version of this package, but I'm not 100% sure of the proper way. I don't have a ton of experience getting Jest to look for the proper versions of files.

I'll try and see if I can find the right config change necessary to get this to work properly and get back to you.

@csandman
Copy link
Owner

csandman commented Sep 5, 2024

Ok, so I ended up switching the "type" of the project back to the default of "commonjs", and this fixes the issue for me. If you install v4.9.2, let me know if the issue is fixed for you all!

Sorry for the late turnaround, I've been very busy recently and haven't had as much time to work on this project as I'd like.

@hatajoe
Copy link
Author

hatajoe commented Sep 5, 2024

@csandman I was able to upgrade successfully. Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants