{"action":"closed","number":13618,"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/13618","id":214661422,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0NjYxNDIy","html_url":"https://github.com/facebook/react/pull/13618","diff_url":"https://github.com/facebook/react/pull/13618.diff","patch_url":"https://github.com/facebook/react/pull/13618.patch","issue_url":"https://api.github.com/repos/facebook/react/issues/13618","number":13618,"state":"closed","locked":false,"title":"Do not bind topLevelType to dispatch","user":{"login":"nhunzaker","id":590904,"node_id":"MDQ6VXNlcjU5MDkwNA==","avatar_url":"https://avatars3.githubusercontent.com/u/590904?v=4","gravatar_id":"","url":"https://api.github.com/users/nhunzaker","html_url":"https://github.com/nhunzaker","followers_url":"https://api.github.com/users/nhunzaker/followers","following_url":"https://api.github.com/users/nhunzaker/following{/other_user}","gists_url":"https://api.github.com/users/nhunzaker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhunzaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhunzaker/subscriptions","organizations_url":"https://api.github.com/users/nhunzaker/orgs","repos_url":"https://api.github.com/users/nhunzaker/repos","events_url":"https://api.github.com/users/nhunzaker/events{/privacy}","received_events_url":"https://api.github.com/users/nhunzaker/received_events","type":"User","site_admin":false},"body":"This PR is exploratory, but it's been on my mind a long time and I wanted to get others' thoughts.\r\n\r\nA previous change (https://github.com/facebook/react/pull/12629) made it such that all top level event types correspond to their associated native event string values. That means we don't need to bind that event name into `dispatchEvent`, letting all event listener code use either the standard dispatch function, or the variant for interactive updates.\r\n\r\n### Why\r\n\r\nMy primary motivation with this PR isn't to necessarily merge this, but to talk about a few event system things.\r\n\r\n#### Why drop bind()\r\n\r\nDropping this `.bind()` is attractive to me because I believe we could eventually remove the logic in`ReactDOMBrowserEventEmitter` to track what events have already attached:\r\n\r\nhttps://github.com/facebook/react/blob/f6fb03edffcc5918ad2f37ed45bdc7c0c3b3d199/packages/react-dom/src/events/ReactBrowserEventEmitter.js#L95-L103\r\n\r\nhttps://github.com/facebook/react/blob/f6fb03edffcc5918ad2f37ed45bdc7c0c3b3d199/packages/react-dom/src/events/ReactBrowserEventEmitter.js#L130-L135\r\n\r\nWhen working on the scroll-jank PR (https://github.com/facebook/react/pull/9333), tracking needs to happen per-element for touch, wheel, and scroll events. That means saving state on each DOM node, and doing a lot of property access.\r\n\r\n#### Could it be faster?\r\n\r\nI'm curious about the performance characteristics of naively attaching the same event. It could avoid a lot of DOM storage and property access (event listener attachment tracking) if we start to attach listeners locally, since `addEventListener` is idempotent:\r\n\r\n```javascript\r\nlet button = document.createElement('button')\r\nlet callback = () => console.log(\"click!\")\r\n\r\nbutton.addEventListener('click', callback)\r\nbutton.addEventListener('click', callback)\r\n\r\nbutton.click()\r\n```\r\n\r\n### Challenges\r\n\r\nWe can't remove event listener tracking because SelectEventPlugin depends on this tracking to see if it should fire:\r\n\r\nhttps://github.com/facebook/react/blob/f6fb03edffcc5918ad2f37ed45bdc7c0c3b3d199/packages/react-dom/src/events/SelectEventPlugin.js#L173-L177\r\n\r\nBut we might be able to come up with another way to determine when SelectEventPlugin should fire. Maybe, **instead of enumerating all plugins at dispatch time, they could be eagerly applied on mount**. Then we also wouldn't have to run through all event plugins on every dispatch because the event plugins would have the context to know that their behavior was specifically applied.\r\n\r\n---\r\n\r\nStill, it's an interesting series of changes to me, and I wanted to get the thoughts of others.","created_at":"2018-09-11T14:54:17Z","updated_at":"2018-09-14T23:08:37Z","closed_at":"2018-09-14T23:08:37Z","merged_at":"2018-09-14T23:08:37Z","merge_commit_sha":"0c9c591bfb4c280d69bc9c1dd692ab0028bb0f8e","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":196858374,"node_id":"MDU6TGFiZWwxOTY4NTgzNzQ=","url":"https://api.github.com/repos/facebook/react/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react/pulls/13618/commits","review_comments_url":"https://api.github.com/repos/facebook/react/pulls/13618/comments","review_comment_url":"https://api.github.com/repos/facebook/react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react/issues/13618/comments","statuses_url":"https://api.github.com/repos/facebook/react/statuses/25819871a4e462e159edad9518b51e510e525645","head":{"label":"nhunzaker:no-bind-dispatch","ref":"no-bind-dispatch","sha":"25819871a4e462e159edad9518b51e510e525645","user":{"login":"nhunzaker","id":590904,"node_id":"MDQ6VXNlcjU5MDkwNA==","avatar_url":"https://avatars3.githubusercontent.com/u/590904?v=4","gravatar_id":"","url":"https://api.github.com/users/nhunzaker","html_url":"https://github.com/nhunzaker","followers_url":"https://api.github.com/users/nhunzaker/followers","following_url":"https://api.github.com/users/nhunzaker/following{/other_user}","gists_url":"https://api.github.com/users/nhunzaker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhunzaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhunzaker/subscriptions","organizations_url":"https://api.github.com/users/nhunzaker/orgs","repos_url":"https://api.github.com/users/nhunzaker/repos","events_url":"https://api.github.com/users/nhunzaker/events{/privacy}","received_events_url":"https://api.github.com/users/nhunzaker/received_events","type":"User","site_admin":false},"repo":{"id":31905862,"node_id":"MDEwOlJlcG9zaXRvcnkzMTkwNTg2Mg==","name":"react","full_name":"nhunzaker/react","owner":{"login":"nhunzaker","id":590904,"node_id":"MDQ6VXNlcjU5MDkwNA==","avatar_url":"https://avatars3.githubusercontent.com/u/590904?v=4","gravatar_id":"","url":"https://api.github.com/users/nhunzaker","html_url":"https://github.com/nhunzaker","followers_url":"https://api.github.com/users/nhunzaker/followers","following_url":"https://api.github.com/users/nhunzaker/following{/other_user}","gists_url":"https://api.github.com/users/nhunzaker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhunzaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhunzaker/subscriptions","organizations_url":"https://api.github.com/users/nhunzaker/orgs","repos_url":"https://api.github.com/users/nhunzaker/repos","events_url":"https://api.github.com/users/nhunzaker/events{/privacy}","received_events_url":"https://api.github.com/users/nhunzaker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nhunzaker/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":true,"url":"https://api.github.com/repos/nhunzaker/react","forks_url":"https://api.github.com/repos/nhunzaker/react/forks","keys_url":"https://api.github.com/repos/nhunzaker/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nhunzaker/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nhunzaker/react/teams","hooks_url":"https://api.github.com/repos/nhunzaker/react/hooks","issue_events_url":"https://api.github.com/repos/nhunzaker/react/issues/events{/number}","events_url":"https://api.github.com/repos/nhunzaker/react/events","assignees_url":"https://api.github.com/repos/nhunzaker/react/assignees{/user}","branches_url":"https://api.github.com/repos/nhunzaker/react/branches{/branch}","tags_url":"https://api.github.com/repos/nhunzaker/react/tags","blobs_url":"https://api.github.com/repos/nhunzaker/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nhunzaker/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nhunzaker/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/nhunzaker/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nhunzaker/react/statuses/{sha}","languages_url":"https://api.github.com/repos/nhunzaker/react/languages","stargazers_url":"https://api.github.com/repos/nhunzaker/react/stargazers","contributors_url":"https://api.github.com/repos/nhunzaker/react/contributors","subscribers_url":"https://api.github.com/repos/nhunzaker/react/subscribers","subscription_url":"https://api.github.com/repos/nhunzaker/react/subscription","commits_url":"https://api.github.com/repos/nhunzaker/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/nhunzaker/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/nhunzaker/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/nhunzaker/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/nhunzaker/react/contents/{+path}","compare_url":"https://api.github.com/repos/nhunzaker/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nhunzaker/react/merges","archive_url":"https://api.github.com/repos/nhunzaker/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nhunzaker/react/downloads","issues_url":"https://api.github.com/repos/nhunzaker/react/issues{/number}","pulls_url":"https://api.github.com/repos/nhunzaker/react/pulls{/number}","milestones_url":"https://api.github.com/repos/nhunzaker/react/milestones{/number}","notifications_url":"https://api.github.com/repos/nhunzaker/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nhunzaker/react/labels{/name}","releases_url":"https://api.github.com/repos/nhunzaker/react/releases{/id}","deployments_url":"https://api.github.com/repos/nhunzaker/react/deployments","created_at":"2015-03-09T15:20:37Z","updated_at":"2018-08-26T18:07:40Z","pushed_at":"2018-09-14T00:48:32Z","git_url":"git://github.com/nhunzaker/react.git","ssh_url":"git@github.com:nhunzaker/react.git","clone_url":"https://github.com/nhunzaker/react.git","svn_url":"https://github.com/nhunzaker/react","homepage":"http://facebook.github.io/react/","size":108457,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"dde0645fcf317ed0042eaca96551f3f0394c68b4","user":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":10270250,"node_id":"MDEwOlJlcG9zaXRvcnkxMDI3MDI1MA==","name":"react","full_name":"facebook/react","owner":{"login":"facebook","id":69631,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5NjMx","avatar_url":"https://avatars3.githubusercontent.com/u/69631?v=4","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":false,"url":"https://api.github.com/repos/facebook/react","forks_url":"https://api.github.com/repos/facebook/react/forks","keys_url":"https://api.github.com/repos/facebook/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react/teams","hooks_url":"https://api.github.com/repos/facebook/react/hooks","issue_events_url":"https://api.github.com/repos/facebook/react/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react/events","assignees_url":"https://api.github.com/repos/facebook/react/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react/tags","blobs_url":"https://api.github.com/repos/facebook/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react/languages","stargazers_url":"https://api.github.com/repos/facebook/react/stargazers","contributors_url":"https://api.github.com/repos/facebook/react/contributors","subscribers_url":"https://api.github.com/repos/facebook/react/subscribers","subscription_url":"https://api.github.com/repos/facebook/react/subscription","commits_url":"https://api.github.com/repos/facebook/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react/merges","archive_url":"https://api.github.com/repos/facebook/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react/downloads","issues_url":"https://api.github.com/repos/facebook/react/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react/deployments","created_at":"2013-05-24T16:15:54Z","updated_at":"2018-09-14T22:23:16Z","pushed_at":"2018-09-14T23:08:37Z","git_url":"git://github.com/facebook/react.git","ssh_url":"git@github.com:facebook/react.git","clone_url":"https://github.com/facebook/react.git","svn_url":"https://github.com/facebook/react","homepage":"https://reactjs.org","size":138362,"stargazers_count":111240,"watchers_count":111240,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":19891,"mirror_url":null,"archived":false,"open_issues_count":366,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":19891,"open_issues":366,"watchers":111240,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/13618"},"html":{"href":"https://github.com/facebook/react/pull/13618"},"issue":{"href":"https://api.github.com/repos/facebook/react/issues/13618"},"comments":{"href":"https://api.github.com/repos/facebook/react/issues/13618/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react/pulls/13618/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react/pulls/13618/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react/statuses/25819871a4e462e159edad9518b51e510e525645"}},"author_association":"COLLABORATOR","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"nhunzaker","id":590904,"node_id":"MDQ6VXNlcjU5MDkwNA==","avatar_url":"https://avatars3.githubusercontent.com/u/590904?v=4","gravatar_id":"","url":"https://api.github.com/users/nhunzaker","html_url":"https://github.com/nhunzaker","followers_url":"https://api.github.com/users/nhunzaker/followers","following_url":"https://api.github.com/users/nhunzaker/following{/other_user}","gists_url":"https://api.github.com/users/nhunzaker/gists{/gist_id}","starred_url":"https://api.github.com/users/nhunzaker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhunzaker/subscriptions","organizations_url":"https://api.github.com/users/nhunzaker/orgs","repos_url":"https://api.github.com/users/nhunzaker/repos","events_url":"https://api.github.com/users/nhunzaker/events{/privacy}","received_events_url":"https://api.github.com/users/nhunzaker/received_events","type":"User","site_admin":false},"comments":5,"review_comments":12,"maintainer_can_modify":false,"commits":3,"additions":23,"deletions":31,"changed_files":4}}
{"actor":{"display_login":"nhunzaker"}}