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

Support React 18 as a peer dependency #312

Merged
merged 6 commits into from
Apr 11, 2024
Merged

Support React 18 as a peer dependency #312

merged 6 commits into from
Apr 11, 2024

Conversation

fongandrew
Copy link
Collaborator

The immediate goal of this PR is to bump the peer dependency of this to support React 18. Per #293 (and as far as I can tell), it shuld work.

But the build dependencies and CI integration for this package are very out of date, so we had to update a whole bunch of other things just to get here.

rQIb4Vw.mp4

As part of this PR, we also bump the package version to v8. It technically shouldn't be necessary for a major version bump just to support React 18, but this integration is sort of undertested with v18. So we're doing a major version bump to force folks to explicit bump what they have rather than just bringing it in by default and maybe seeing things subtly breaking unexpectedly.

Based on #293,
it appears this package works fine with React 18
This resolves a whole bunch of warnings and build issues
from using out of date packages. Became sort of necessary
when we couldn't npm install anymore because our
out-of-date node-sass version demanded Python v2.
Fix some test failures that surfaced with newest version of Jest
We've expanded our peer dependencies to allow React 18.
This isn't really a breaking change, but usage of this with
React >16 is under-tested. So we're going to do a major
version bump so that any projects that depend on this
package don't implicitly pick up this new version,
resolve to a different version of React, and suddenly find
old things not working.

Also, we revamped the build code and there are minor
compiler / TypeScript-ish changes there, so a little
extra caution feels warranted.
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is admittedly weird, but this directive is needed because @nteract/mockument is loaded before every Jest test (and it's doing a few setup things that even the server version of this package seems to dpeend on).

In an ideal world, we'd probably remove this and put a little more thought into what the server-side rendering environment looks like.

this.uCallback = sinon.spy(next);
this.uCallback();
uCallback = sinon.spy(next);
uCallback();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TypeScript doesn't like this floating this (which ends up referring to window, which is how the tests previously passed).

@@ -192,7 +213,9 @@ describe('DOM Events', () => {
expect(onFocus).toBeTruthy();
done();
}}
/>);
/>,
{ attachTo: container }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Focus-related Enzyme tests don't work without being attached to an actual DOM element in the document.

@fongandrew fongandrew merged commit b4039e4 into master Apr 11, 2024
2 checks passed
This pull request was closed.
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.

1 participant