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

fix: reading reactInternals from null instance #6

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

sienic
Copy link
Contributor

@sienic sienic commented Feb 27, 2023

The onRenderCb sets the instance after getNode() gets called, which inside the wrapAct tries to access the _reactInternals property of instance (by that time null), thus raising TypeError: Cannot read properties of null (reading '_reactInternals').

The `onRenderCb` sets the `instance` after calling `getNode()`, which
inside the `wrapAct` tries to access the `_reactInternals` property of
`instance` (by that time `null`), thus raising `TypeError: Cannot read
properties of null (reading '_reactInternals')`.
@cfaester
Copy link
Owner

Hi, @sienic - great PR, I'll take a look at it 👍

@thecristen
Copy link

I tried this while working to migrate a repo with hundreds of Enzyme tests to React 18. While I still have some failing tests (around not finding nodes it used to be able to find), this PR did successfully fix the TypeError: Cannot read properties of null (reading '_reactInternals') error. Thanks! 🎩

@cfaester
Copy link
Owner

Looks great @sienic . This will be hitting 0.7.0 later today.

@cfaester cfaester merged commit b6dc23b into cfaester:main Mar 10, 2023
MonkeyDo added a commit to metabrainz/listenbrainz-server that referenced this pull request Mar 10, 2023
This was a hacky way to resolve an issue with enzyme-adapter-react-18.
Following a PR cfaester/enzyme-adapter-react-18#6 we shouldn't need to manually unmount the test wrappers anymore. Also see cfaester/enzyme-adapter-react-18#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants