-
Notifications
You must be signed in to change notification settings - Fork 810
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 .bind(this) from removePortal call #348
Conversation
This test has failed: Use |
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.
Fix tests.
My fix was actually bad. It was causing |
erm, I think I shouldn't have used es6. |
@mreishus I changed the base of this commit to the If this fix was indeed intended to go to |
Chances are you'll probably want to just rebase on v1 and do a forced push to clean things up though. |
OK, redid off |
Don't merge this please, it causes the same uglifyJS error that happened in issue 336. |
I was thinking that it might @mreishus, my guess is it's the |
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.
() => {}
> function() {}
.
This fixes this warning from react in the console without breaking functionality: Warning: bind(): You are binding a component method to the component. React does this for you automatically in a high-performance way, so you can safely remove this call. See Modal
done |
Released in 1.7.2 |
@@ -94,7 +94,7 @@ var Modal = React.createClass({ | |||
this.portal.closeWithTimeout(); | |||
} | |||
|
|||
setTimeout(this.removePortal.bind(this), closesAt - now); | |||
setTimeout(function() { this.removePortal(); }, closesAt - 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.
I think removePortal
won't be available on this
in setTimeout
which will have this
context of window
? If you don't use arrow function, it won't scope capture.
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, you are right!
Fixes the binding of the `removePortal` call in the `setTimeout` callback by capturing a this reference in a variable in the closure scope. Doesn't use `bind` which apparently causes warnings. Fixes reactjs#344, fixes reactjs#348
Fixes the binding of the `removePortal` call in the `setTimeout` callback by capturing a this reference in a variable in the closure scope. Doesn't use `bind` which apparently causes warnings. Fixes reactjs#344, fixes reactjs#348
This fixes this warning from react in the console without breaking functionality:
Fixes #344.
This doesn't fix a bug or change the API, it should be basically a "silent" change.
Acceptance Checklist:
CONTRIBUTING.md
.