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

Upgrade to latest react #24

Merged
merged 5 commits into from
Jan 15, 2020
Merged

Upgrade to latest react #24

merged 5 commits into from
Jan 15, 2020

Conversation

yasincanakmehmet
Copy link
Contributor

We want to start using React v16.12 in some of our projects that is using the connect-backbone-to-react. Even though upgrading the react version does not cause any problems for our application, we still want to validate that all the tests for the CBR passes with the latest version.

Big shoutout to @ghmeier for his PR :) My initial idea was to fix his PR which uses context providers but that would also require changes in our application. That's why I have decided to create this PR.

@yasincanakmehmet
Copy link
Contributor Author

I could not add reviewers but if @ghmeier, @hswolff & @wearhere can take a look, that would be great!

Copy link
Contributor

@ghmeier ghmeier left a comment

Choose a reason for hiding this comment

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

Overall looks good to me! I agree that just updating tests is probably the way to go first :)

package.json Outdated
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0"
"react": "^16.0.0-0"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have tests for each of these versions?

Choose a reason for hiding this comment

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

If it's possible to continue to support the older versions of React, I think that'd be nice and then yeah we'd probably want to test them. Not sure how difficult it would be to continue to support the older versions especially with renamed APIs like UNSAFE_componentWillReceiveProps—I also think it would be fine to drop support and call this a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO calling this a breaking change and supporting v16 is the way to go. Not sure if supporting older versions of React will have a significant benefit but as we keep improving (hooks, context providers), we won't support the older versions anyways.

Copy link
Member

Choose a reason for hiding this comment

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

Feels weird to release a new major version that doesn't break backwards compatibility yet.

I'm fine either merging this in as is but wait to publish until we introduce actual breaking changes

or

back this change out and just release as a minor version update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

UNSAFE_ was introduced with v16.3 I believe, so with any older version of react, it will not work. Thus my "react": "^16.0.0-0" is actually wrong as well and it should be a minimum v16.3. The library tests fails with older versions of react and even with v16.0. (I need to update the peer dependency version to v16.3)

If we won't be publishing it, then I do not see the benefit of merging this. It would be better to do this as a part of an improvement (such as adding hooks) and not just dependency version update but I am not sure if that would be useful. We can focus on the PR by @ghmeier and do these changes along with that and release that.

v0.14 || v15.0 will not work so we can not change this out and release a minor version

Copy link
Member

Choose a reason for hiding this comment

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

So the other other option is to release this as a major version with these changes? I'm ok with that too. I agree with your reasoning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So let's do this as a major release. I will go ahead and merge the PR. Do we have documentation for the release process?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have permissions :) Feel free to merge and release if it's all good.

assert.equal(userModel.get('name'), newName);
assert.equal(stub.props().name, newName);
assert.equal(wrapper.find(TestComponent).prop('name'), newName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Good to know that this is because something changed in enzyme rather than something new in react.

});

it('should return the wrapped component via getWrappedInstance()', function() {
assert.equal(wrapper.instance().getWrappedInstance(), stub.node);
assert.equal(wrapper.instance().getWrappedInstance(), stub.instance());
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat!

@hswolff hswolff self-requested a review December 17, 2019 04:07
@@ -96,7 +96,7 @@ describe('connectBackboneToReact', function() {
});

afterEach(function() {
wrapper.unmount();
if (wrapper.exists()) wrapper.unmount();
Copy link
Member

Choose a reason for hiding this comment

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

Why is this now required? What changed? Seems like a bandaid when there is some other underlying issue at hand?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So there are 2 tests which unmounts inside the test so when the afterEach tries to run the unmount again it fails. That's why I will just keep this if check in the afterEach and I have removed from the individual tests.

When removed 2 tests results in an error Error: Method “unmount” is meant to be run on 1 node. 0 found instead. we have upgraded to 3.10 and I found this in the enzyme issues enzymejs/enzyme#1880

Copy link
Member

Choose a reason for hiding this comment

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

Aha, got it.

package.json Outdated
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0 || ^16.0.0-0"
"react": "^16.0.0-0"
Copy link
Member

Choose a reason for hiding this comment

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

Feels weird to release a new major version that doesn't break backwards compatibility yet.

I'm fine either merging this in as is but wait to publish until we introduce actual breaking changes

or

back this change out and just release as a minor version update.

@hswolff hswolff merged commit 02bfe5e into mongodb-js:master Jan 15, 2020
@hswolff
Copy link
Member

hswolff commented Jan 15, 2020

Published!

@hswolff
Copy link
Member

hswolff commented Jan 15, 2020

Thank you everyone!!

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.

4 participants