Skip to content

Fix act polyfill for React 15.x #288

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

Merged

Conversation

alexzherdev
Copy link
Contributor

Fixes #287

What:

Restore compatibility with React 15.x.

Why:

The polyfill for act stopped working because ReactDOM.render(null, div) throws in React 15.x.

How:

Need to just render a dummy div in act polyfill.

Checklist:

  • Documentation N/A
  • Tests N/A
  • Ready to be merged
  • Added myself to contributors table

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kentcdodds kentcdodds merged commit ac58967 into testing-library:master Feb 8, 2019
@alexzherdev alexzherdev deleted the 287-fix-act-polyfill branch February 8, 2019 23:56
@alexzherdev
Copy link
Contributor Author

Awesome! Out of curiosity, can you clarify what that render does?

@kentcdodds
Copy link
Member

🎉 This PR is included in version 5.5.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kentcdodds
Copy link
Member

It forces all effect callbacks to run synchronously.

@alexzherdev
Copy link
Contributor Author

I meant the ReactDOM.render(<div />), not the ReactDOM.unstable_batchedUpdates. The test for the act polyfill passes without that ReactDOM.render call. No worries though.

lucbpz pushed a commit to lucbpz/react-testing-library that referenced this pull request Jul 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5.5.3 breaks testing for React 15
2 participants