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 19 support + change deps #88

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

imjordanxd
Copy link

@imjordanxd imjordanxd commented Dec 19, 2024

Overview

Adds React 19 peer dependency support. Also changed a lot of outdated dependencies (some of the open PRs may now be redundant). No runtime code needed to be changed thankfully I changed componentWillMount to componentDidMount and all test pass. This is a good sign. Renovate bot and a yarn GH workflow for this repo would be great!

[
"@babel/preset-react",
{
"runtime": "automatic"
Copy link
Author

Choose a reason for hiding this comment

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

breaking change

"test": "mocha",
"test:watch": "mocha --watch",
"test:cov": "babel-node ./node_modules/.bin/isparta cover ./node_modules/.bin/_mocha"
"test": "jest --forceExit",
Copy link
Author

Choose a reason for hiding this comment

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

there are open handles now and i didn't have enough time to figure out why. It's the node MessageChannel class

@@ -15,12 +15,9 @@ const config = {
babel({
babelrc: false,
presets: [
'@babel/preset-react',
['@babel/preset-react', { runtime: 'automatic' }],
Copy link
Author

Choose a reason for hiding this comment

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

Comment on lines -21 to -23
plugins: [
'@babel/plugin-proposal-class-properties',
],
Copy link
Author

Choose a reason for hiding this comment

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

included in @babel/preset-env

@@ -12,7 +17,6 @@
]
],
"plugins": [
"@babel/plugin-proposal-class-properties",
Copy link
Author

Choose a reason for hiding this comment

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

@martinnaj
Copy link

Would be nice to remove the UNSAFE_componentWillMount. Seems someone got this working without it nfl/react-helmet#548

@imjordanxd
Copy link
Author

@gaearon can you look at this?

@@ -45,7 +45,7 @@ export default function withSideEffect(
}
}

class SideEffect extends PureComponent {
class SideEffect extends React.PureComponent {
Copy link
Author

Choose a reason for hiding this comment

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

perhaps in the next major, this could be a functional component

Comment on lines -184 to -212
const originalWindow = global.window;
const originalDocument = global.document;

before(done => {
jsdom.env('<!doctype html><html><head></head><body></body></html>', (error, window) => {
if (!error) {
global.window = window;
global.document = window.document;
}

done(error);
});
});

after(() => {
global.window = originalWindow;
global.document = originalDocument;
});

it('should be findable by react TestUtils', () => {
class AnyComponent extends React.Component {
render() {
return <SideEffect foo="bar" />
}
}
const wrapper = enzyme.shallow(<AnyComponent />);
const sideEffect = wrapper.find(SideEffect)
expect(sideEffect.props()).to.deep.equal({ foo: 'bar' });
});
Copy link
Author

Choose a reason for hiding this comment

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

all of this seemed redundant now

@@ -31,30 +31,27 @@
"Louis DeScioli (https://descioli.design)"
],
"peerDependencies": {
"react": "^16.3.0 || ^17.0.0 || ^18.0.0"
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
Copy link
Author

Choose a reason for hiding this comment

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

@imjordanxd
Copy link
Author

@gaearon bump! Could you review this? 🙏

@imjordanxd
Copy link
Author

bump @gaearon

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.

2 participants