-
Notifications
You must be signed in to change notification settings - Fork 308
Conversation
Thanks for opening this!!! In case it helps as we're getting ci fixed up on this, probably about time to switch Travis versions to: node_js:
- "6"
- "8"
- "10" (Appveyor is already there...) |
Something we've added is failing on uglify
Probably worth looking at transpiled output (webpack should be consuming |
And to save you round trips to CI, all of this should work/fail the same in localhost: $ yarn run build-examples
$ yarn run lint
$ yarn run build
$ yarn run test-coverage |
Yeah, I'm working on the CI fixes. I think I don't need to use |
- Remove node 4 - Add node 10
Use Reflect to construct class in a more compatible manner. Reflect should be available in environments that use es6 classes.
Looks like tests are passing. Not sure if you have any other way to verify this won't break things for people who were using es native classes out there. It does seem to fix the issue for me if I hand-patch node_modules using the generated file from |
@dobesv -- Great work! You changes still pass the original regression test I wrote for ES native classes at: Lines 56 to 66 in 0f7521f
@boygirl @alexlande -- We've got some great work here that I don't have time right now to kick the tires on. Can you recruit someone to vet this and possibly merge + release? Thanks!!! |
Any ETA on this one? |
I believe @kylecesmat is going to look at this when he has a chance, hopefully this upcoming week. Thanks for your patience! (I'd jump in and try to wrangle it, but I'm on parental leave with a newborn 👶 ) |
I'm checking this out right now! |
const Enhanced = Enhancer(TestComponent); | ||
const elt = React.createElement(Enhanced, {flag: true}); | ||
const {configure, mount} = require('enzyme'); | ||
const Adapter = require('enzyme-adapter-react-16'); |
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.
I do want to see if we can refactor some of our existing tests to use jsdom/enzyme - in which case moving these to top-level requires. But this implementation is great for now.
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.
Yeah, since I'm not a core contributor I wanted to have minimal impact.
- "6" | ||
- "8" | ||
- "10" |
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.
Thanks for updating this!
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.
Well, I had to in order to get a green light on the PR :)
|
||
return this; | ||
// Use Reflect.construct to simulate 'new' | ||
const obj = Reflect.construct( |
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.
What are the implications of using Reflect
in regards to cross-browser support? I believe IE11 is the only browser that will need a polyfill, would you be able to add a note in the README about including a polyfill like https://github.com/zloirock/core-js#ecmascript-reflect?
A note in this section would probably be best - https://github.com/FormidableLabs/radium#importing-radium
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.
@kylecesmat I don't think you can create a "native class" in IE11, so this code would never run in that browser.
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.
Apologies for the delay, your PR looks great! Just one ask to make a note about requiring a polyfill for . I'm actually going to take care of this before release.Reflect
in IE, and after that I'll merge + release
I believe this should be released as a patch. A minor release feels a bit safer, so that IE11 consumers are not inheriting these changes.
This has been released in |
Use Reflect to construct class in a more compatible manner.
Reflect should be available in environments that use es6 classes.
This can fix #999 because we preserve the same value of
this
as was used in the object constructor, whereas the previous implementation discarded that object and used a new object after calling the constructor. That resulted in some confusing behavior if the constructor stored referenced tothis
or bound methods / functions tothis
.