-
Notifications
You must be signed in to change notification settings - Fork 77
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
base: master
Are you sure you want to change the base?
Conversation
[ | ||
"@babel/preset-react", | ||
{ | ||
"runtime": "automatic" |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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' }], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugins: [ | ||
'@babel/plugin-proposal-class-properties', | ||
], |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be nice to remove the UNSAFE_componentWillMount. Seems someone got this working without it nfl/react-helmet#548 |
@gaearon can you look at this? |
@@ -45,7 +45,7 @@ export default function withSideEffect( | |||
} | |||
} | |||
|
|||
class SideEffect extends PureComponent { | |||
class SideEffect extends React.PureComponent { |
There was a problem hiding this comment.
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
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' }); | ||
}); |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
16.14.0
is the min version now: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#how-to-upgrade-to-the-new-jsx-transform
@gaearon bump! Could you review this? 🙏 |
bump @gaearon |
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 thankfullyI changedcomponentWillMount
tocomponentDidMount
and all test pass. This is a good sign. Renovate bot and a yarn GH workflow for this repo would be great!