-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Remove static properties for ie8 compatibility #2540
Conversation
Please either bump |
How do I blacklist a plugin for babel? Googling proved messy. I think if that's doable, it'd be best since it's the smallest surface area change. |
{
"stage": 0,
"loose": "all",
"blacklist": [
"es7.classProperties"
],
"plugins": [
"dev-expression"
]
} off the top of my head, but you should double check that this works (i.e. that Babel throws a fit at you if you then try to use a class property) |
Boom. it worked! Well done. Some features are hard to find, didn't know that was a thing! |
Can you squash those commits? |
44787a5
to
7d7dc75
Compare
done |
You need to update the tests as well, I think. |
all the tests pass for me locally, are you saying there is a test I should add for this? |
Not with the Babel changes. See e.g. https://github.com/rackt/react-router/blob/v1.0.0/modules/__tests__/Router-test.js#L258-L260. Might make more sense to de-blacklist that transform for tests, though. |
onEnter: falsy, | ||
children: falsy | ||
} | ||
IndexRedirect.createRouteFromReactElement = function (element, parentRoute) { |
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.
(nit) The spacing is off on this one. This is purely a style thing.
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.
Sure, but what's off exactly? I'm adding a space between the propTypes and the function creation, is that what you're talkin about? Just want to make sure I understand.
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.
Yes, that and the two spaces after the createRouteFromReactElement
function. It looks like that's just shifted up one line.
Babel doesn't transform statics to normal object properties? |
Nope, it uses |
Hey guys, Sorry I'm having issues figuring out how to best make the tests not use the On Fri, Nov 13, 2015 at 12:05 PM, Jimmy Jia notifications@github.com
|
Just clean up the tests to not use class properties then. Probably easiest way to do it. |
Hey guys, I've made the appropriate changes, can someone confirm that this (https://github.com/rackt/react-router/pull/2540/files#diff-82b958d0880900cdd7c05f94eb64e281R271) looks okay to them? |
c4ea78c
to
6e07091
Compare
@@ -272,7 +268,7 @@ describe('Router', function () { | |||
render() { | |||
const { label, children } = this.props | |||
const child = React.cloneElement(children, { | |||
createElement: this.createElement | |||
createElement: this.createElement.bind(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.
Nit - please bind this in the constructor. Even though this is in test code, I'd rather not users accidentally follow this pattern without recognizing the consequences.
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.
Ah, my bad. For my own knowledge, what is the downside of this? Just that
one would have to continually bind it vs it being bound for every use?
On Fri, Nov 13, 2015 at 3:08 PM, Jimmy Jia notifications@github.com wrote:
In modules/tests/Router-test.js
#2540 (comment):@@ -272,7 +268,7 @@ describe('Router', function () {
render() {
const { label, children } = this.props
const child = React.cloneElement(children, {
createElement: this.createElement
createElement: this.createElement.bind(this)
Nit - please bind this in the constructor. Even though this is in test
code, I'd rather not users accidentally follow this pattern without
recognizing the consequences.—
Reply to this email directly or view it on GitHub
https://github.com/rackt/react-router/pull/2540/files#r44828136.
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.
Yes - it breaks referential equality, which leads to e.g. pure render not working. It seldom ever really matters, but it's just good hygiene.
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.
Awesome, thanks for the explanation. And your help in general. (Happy
friday everyone!).
On Fri, Nov 13, 2015 at 3:24 PM, Jimmy Jia notifications@github.com wrote:
In modules/tests/Router-test.js
#2540 (comment):@@ -272,7 +268,7 @@ describe('Router', function () {
render() {
const { label, children } = this.props
const child = React.cloneElement(children, {
createElement: this.createElement
createElement: this.createElement.bind(this)
Yes - it breaks referential equality, which leads to e.g. pure render not
working. It seldom ever really matters, but it's just good hygiene.—
Reply to this email directly or view it on GitHub
https://github.com/rackt/react-router/pull/2540/files#r44829782.
6e07091
to
a0877f9
Compare
@timdorr Did this catch all the code nits you saw? I think dropping static properties is worth it if that's all it takes for us to support IE8. |
LGTM.
|
Woot! Thanks for everyone's help! |
@taion Did you want to merge this or should I? |
I don't want @mjackson to yell at me again 🙈 😆 I'll merge though :D |
Remove static properties for ie8 compatibility
Oops, slipped up - https://github.com/rackt/react-router/pull/2540/files#diff-82b958d0880900cdd7c05f94eb64e281R259 is wrong. I'm just going to fix in a separate PR. |
@ryanflorence What do you think of cutting a v1.0.1 for this? Thus far, as far as I can tell, nothing else has come up that we can resolve before v1.1.0. |
I would love to see that too. It's been two weeks, so a minor update isn't a big deal 😄 |
By removing usages of class-properties which are still experimental, ie8 is fully supported. We also protect against it happening in the future with a blacklist of that feature in babel.