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

15.5 support #147

Merged
merged 7 commits into from May 11, 2017
Merged

15.5 support #147

merged 7 commits into from May 11, 2017

Conversation

KamranAsif
Copy link
Contributor

@KamranAsif KamranAsif commented Apr 12, 2017

Description

Adding support for React 15.5
I used the codemods to add support
I couldn't get the site to run though; I kept seeing this error:

> fixed-data-table-2@0.7.14 site-dev-server /Users/Heaven/Work/fixed-data-table-2
> ./build_helpers/startSiteDevServer.sh

/Users/Heaven/Work/fixed-data-table-2/node_modules/react-docgen/dist/parse.js:60
    throw new Error(ERROR_MISSING_DEFINITION);
    ^

Error: No suitable component definition found.

@wcjordan could you check out this branch and give it a try?

Motiviations

#145

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.

@wcjordan
Copy link
Member

@KamranAsif this is because react-docgen doesn't yet support create-react-class. I've opened an issue. In the meantime you can change the package.json entry for react-docgen to point to "git://github.com/wcjordan/react-docgen#create_react_class_support_dist" and it should work. It uncovers some other errors though.

@@ -101,7 +101,7 @@ var FixedDataTableBufferedRows = createReactClass({
},

_updateBuffer() {
if (this.isMounted()) {
if (this._rowBuffer) {
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 know if this is a safe fix yet. The usage of isMounted scattered through seems scary

Copy link
Member

Choose a reason for hiding this comment

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

Hmm it seems fine to me, but ya removing isMounted wherever possible sounds good.

@KamranAsif
Copy link
Contributor Author

Thanks for the fix @wcjordan!

Ran codemods on some more files. I'm trying to get the site to run without any errors.

@KamranAsif
Copy link
Contributor Author

My next step is to remove the isMounted calls from FixedDataTable.js
https://github.com/schrodinger/fixed-data-table-2/blob/master/src/FixedDataTable.js#L1153

These seem a bit scary to me. I think we can fix a lot of these by removing the scroll handler when the component unmounts.

@wcjordan
Copy link
Member

Sweet, this all looks good to me and removing unmount by removing the scroll handler sounds good. Consider this review lgtm'd and open a new one for the unmount change?

@KamranAsif
Copy link
Contributor Author

@wcjordan I added this isMounted calls to this PR. You can view them seperately here: bbe16c8

Copy link

@bmv437 bmv437 left a comment

Choose a reason for hiding this comment

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

Hey @KamranAsif, I've tested your PR and it works! No more PropTypes or createClass warnings 🎉
Haven't noticed any issues. Please merge and release when you get a chance. Thanks for all your hard work 👍

props.stopScrollPropagation
);

this.setState(this._calculateState(props));
},

componentWillUnmount() {
this._wheelHandler = null;
Copy link
Member

Choose a reason for hiding this comment

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

Is there any risk of the onWheel still firing when we unmount? Or should we be okay since the DOM object is expected to be gone?

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 think it will be an issue. React will automatically detach the scroll handler.

@@ -368,6 +368,7 @@ var FixedDataTable = createReactClass({
this._onScroll,
this._shouldHandleTouchX,
this._shouldHandleTouchY
Copy link

Choose a reason for hiding this comment

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

Needs a comma at the end of this line, that's why the build is failing on TravisCI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, will fix

@bmv437
Copy link

bmv437 commented May 3, 2017

@KamranAsif Looks like Node v4 tests failed because it couldn't find the prop-types package. I think prop-types needs to get added to the devDependencies. That will probably fix the test.
Failed Test Log
package.json missing prop-types

@KamranAsif
Copy link
Contributor Author

Yeah I saw the issue. Right now I'm just super busy onboarding at a new company so I haven't found time to wrap this up

@bmv437
Copy link

bmv437 commented May 3, 2017

No worries. Just trying to assist however I can. Thanks!

package.json Outdated
@@ -39,6 +39,7 @@
"null-loader": "^0.1.0",
"postcss": "^4.0.2",
"postcss-custom-properties": "3.0.1",
"prop-types": "^15.5.8",
Copy link
Member

Choose a reason for hiding this comment

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

Should this & create-react-class be dependencies? React-redux has them as such
https://github.com/reactjs/react-redux/blob/master/package.json

Also update react-docgen version & ExampleImage to not use isMounted
@wcjordan
Copy link
Member

@KamranAsif I updated the dependencies to be non-dev & I fixed a usage of isMounted in ExampleImage.
3b99f19

I think we should be ready to go if the tests pass.

@KamranAsif
Copy link
Contributor Author

@wcjordan Actually..we don't list React or ReactDom as deps; instead as peer devs. Should these two be the same?

@KamranAsif
Copy link
Contributor Author

I'm going merge this and push it out to unblock anyone

@KamranAsif KamranAsif merged commit 4527549 into schrodinger:master May 11, 2017
@wcjordan
Copy link
Member

wcjordan commented May 11, 2017

The issue with having them as peer deps is a React 14 or 15.1 user might be using the library, upgrade and then blow up cause they don't include prop-types & create-react-class. The peer deps will warn them... but still I think it's better to bring them in ourselves.

They're not big and I expect them to be stable so worst case we bundle a couple versions of them, it's not the end of the world.

Also looking at and following react-redux's practice:
https://github.com/reactjs/react-redux/blob/master/package.json

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.

None yet

3 participants