Skip to content

Support React 18 as a peer dependency - #312

Merged
fongandrew merged 6 commits into
masterfrom
bump-peer-dep-af
Apr 11, 2024
Merged

Support React 18 as a peer dependency#312
fongandrew merged 6 commits into
masterfrom
bump-peer-dep-af

Conversation

@fongandrew

Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread test/index.spec.tsx
this.uCallback = sinon.spy(next);
this.uCallback();
uCallback = sinon.spy(next);
uCallback();

Copy link
Copy Markdown
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).

Comment thread test/index.spec.tsx
}}
/>);
/>,
{ attachTo: container }

Copy link
Copy Markdown
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
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