Skip to content

Use a closure to bind argument to callback in ReactErrorUtils - #8363

Merged
gaearon merged 2 commits into
react:masterfrom
aweary:dev-event-handler-args
Nov 28, 2016
Merged

Use a closure to bind argument to callback in ReactErrorUtils#8363
gaearon merged 2 commits into
react:masterfrom
aweary:dev-event-handler-args

Conversation

@aweary

Copy link
Copy Markdown
Contributor

See discussion starting here.

This prevents the fake event used here from being passed to the callback. This was causing issues where event handlers received an extra argument in dev only.

@gaearon I verified this fix resolves the issue by building and testing in the basic click counter example. I'm not sure where a unit test for this would go.

This way the fake event isn't being implicitly passed into the event handler
@gaearon

Copy link
Copy Markdown
Collaborator

Feel free to add a test for ReactErrorUtils if one doesn't exist already. You could also look at change history to see if there were any related tests introduced with this file in the first place.

Can you confirm single argument matches production behavior?

@aweary

Copy link
Copy Markdown
ContributorAuthor

@gaearon I added test for ReactErrorUtils 👍

@gaearon

Copy link
Copy Markdown
Collaborator

Lint is failing.

@gaearon

Copy link
Copy Markdown
Collaborator

Tagging as minor since somebody might have accidentally relied on that.

@gaearon

Copy link
Copy Markdown
Collaborator

Linter fails.

Add fiber test report
Linting fixes
@aweary
awearyforce-pushed the dev-event-handler-args branch from 996e59d to f293884CompareNovember 28, 2016 16:31
@aweary

Copy link
Copy Markdown
ContributorAuthor

@gaearon fixed 👍

@gaearon
gaearon merged commit 6947db1 into react:masterNov 28, 2016
@gaearon

Copy link
Copy Markdown
Collaborator

LGTM

@gaearongaearon modified the milestones: 15-hipri, 15-lopriJan 6, 2017
@aweary
aweary deleted the dev-event-handler-args branch January 26, 2017 16:18
acusti pushed a commit to brandcast/react that referenced this pull request Mar 15, 2017
…8363)
* Use a closure to bind gaurded callback
This way the fake event isn't being implicitly passed into the event handler
* Add tests for ReactErrorUtils
Add fiber test report
Linting fixes
@awearyaweary mentioned this pull request Jul 11, 2017
12 tasks
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
…8363)
* Use a closure to bind gaurded callback
This way the fake event isn't being implicitly passed into the event handler
* Add tests for ReactErrorUtils
Add fiber test report
Linting fixes
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@aweary@gaearon@Heedster@facebook-github-bot