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

React 18.3.1 w/ grommet useState fails #7228

Open
Aubrey-Russell opened this issue May 14, 2024 · 5 comments
Open

React 18.3.1 w/ grommet useState fails #7228

Aubrey-Russell opened this issue May 14, 2024 · 5 comments
Labels
bug issue that does not match design or documentation and requires code changes to address

Comments

@Aubrey-Russell
Copy link

Updating to react 18.3.1 breaks grommetjs

Expected Behavior

It should work normally

Actual Behavior

Uncaught TypeError: Cannot read properties of null (reading 'useState')
at useState (react.development.js:1622:1)
at Grommet.js:53:27
at renderWithHooks (react-dom.development.js:15486:1)
at updateForwardRef (react-dom.development.js:19245:1)
at beginWork (react-dom.development.js:21675:1)
at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1)
at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1)
at invokeGuardedCallback (react-dom.development.js:4277:1)
at beginWork$1 (react-dom.development.js:27490:1)
at performUnitOfWork (react-dom.development.js:26596:1)

URL, screen shot, or Codepen exhibiting the issue

image

Steps to Reproduce

Install grommet 2.37.0 with react 18.3.1

Your Environment

VS code react application with grommetjs

  • Grommet version: "grommet": "^2.37.0",
  • Browser Name and version: edge
  • Operating System and version (desktop or mobile): windows
@jcfilben jcfilben added the bug issue that does not match design or documentation and requires code changes to address label May 14, 2024
@jcfilben
Copy link
Collaborator

I tried to reproduce the issue in this codesandbox but wasn't getting an error. Let me know if there is anything I should adjust in my codesandbox to be able to reproduce the issue.

@Aubrey-Russell
Copy link
Author

@jcfilben thank you very much for checking, I am attempting to replicate it on my end on a fresh repo so I will post here if I am able to. We are running a complex micro front end environment so its possible something specific to our project is leading to an unexpected interaction. Thanks again!

@Aubrey-Russell
Copy link
Author

Hi, I managed to replicate it here at this repo and will try to import into code sandbox as well:

https://github.com/Aubrey-Russell/grommet-react-mfe-issue-example

This is using nx nrwl as a framework for context:

image

@jcfilben
Copy link
Collaborator

Thanks for putting together the sample repo, I cloned it and ran nx serve mfe-ex-1 but didn't see any errors in the console. For more context I'm using pnpm v8.7.6. Also I haven't used nx before so not sure if I'm missing anything there or running things incorrectly

@Aubrey-Russell
Copy link
Author

@jcfilben Hi, sorry I thought I had included instructions in the readme but I did not.

Please run pnpm nx serve shell. I have also created the issue in the nx nrwl repo .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issue that does not match design or documentation and requires code changes to address
Projects
None yet
Development

No branches or pull requests

2 participants