{"action":"opened","number":15182,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/15182","id":132176204,"html_url":"https://github.com/facebook/react-native/pull/15182","diff_url":"https://github.com/facebook/react-native/pull/15182.diff","patch_url":"https://github.com/facebook/react-native/pull/15182.patch","issue_url":"https://api.github.com/repos/facebook/react-native/issues/15182","number":15182,"state":"open","locked":false,"title":"Remove usage of the ... operator in BackHandler","user":{"login":"dantman","id":53399,"avatar_url":"https://avatars2.githubusercontent.com/u/53399?v=4","gravatar_id":"","url":"https://api.github.com/users/dantman","html_url":"https://github.com/dantman","followers_url":"https://api.github.com/users/dantman/followers","following_url":"https://api.github.com/users/dantman/following{/other_user}","gists_url":"https://api.github.com/users/dantman/gists{/gist_id}","starred_url":"https://api.github.com/users/dantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantman/subscriptions","organizations_url":"https://api.github.com/users/dantman/orgs","repos_url":"https://api.github.com/users/dantman/repos","events_url":"https://api.github.com/users/dantman/events{/privacy}","received_events_url":"https://api.github.com/users/dantman/received_events","type":"User","site_admin":false},"body":"This usage of `...` currently causes BackHandler to silently become non-functional when a `Symbol` polyfill is used.\r\n\r\nWhy?\r\n- The `[...obj]` operator implicitly calls the object's iterator to fill the array\r\n- react-native's internal `Set` polyfill has a load order issue that breaks it whenever a project uses a `Symbol` polyfill\r\n- This means that when `BackHandler` tries to `[...set]` a `Set` of subscriptions the result is always an empty array instead of an array of subscriptions\r\n\r\nAdditionally it's worth noting that the current code is also wastefully inefficient as in order to reverse iterate over subscriptions it:\r\n- Clones the `Set` (which fills it by implicitly running the set's iterator)\r\n- Uses `[...set]` to convert the cloned set into an array (which also implicitly runs the iterator on the clone)\r\n- Finally reverses the order of the array\r\n\r\n----\r\n\r\nThis code fixes this problem by replacing the use of multiple Set instance iterators with a simple `.forEach` loop that unshifts directly into the final array.\r\n\r\nI've tested this by opening the repo's RNTester app on Android and tvOS ensuring that the back handler works before changes, the application crashes when I introduce an error (to verify my code changes are being applied to the app), the back handler works and after changes.\r\n\r\nFixes #11968","created_at":"2017-07-25T01:03:58Z","updated_at":"2017-07-25T01:03:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react-native/pulls/15182/commits","review_comments_url":"https://api.github.com/repos/facebook/react-native/pulls/15182/comments","review_comment_url":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/15182/comments","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/01fb46a698d65efe956f8b6c0fd8966cec360e06","head":{"label":"dantman:back-fix","ref":"back-fix","sha":"01fb46a698d65efe956f8b6c0fd8966cec360e06","user":{"login":"dantman","id":53399,"avatar_url":"https://avatars2.githubusercontent.com/u/53399?v=4","gravatar_id":"","url":"https://api.github.com/users/dantman","html_url":"https://github.com/dantman","followers_url":"https://api.github.com/users/dantman/followers","following_url":"https://api.github.com/users/dantman/following{/other_user}","gists_url":"https://api.github.com/users/dantman/gists{/gist_id}","starred_url":"https://api.github.com/users/dantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantman/subscriptions","organizations_url":"https://api.github.com/users/dantman/orgs","repos_url":"https://api.github.com/users/dantman/repos","events_url":"https://api.github.com/users/dantman/events{/privacy}","received_events_url":"https://api.github.com/users/dantman/received_events","type":"User","site_admin":false},"repo":{"id":52074084,"name":"react-native","full_name":"dantman/react-native","owner":{"login":"dantman","id":53399,"avatar_url":"https://avatars2.githubusercontent.com/u/53399?v=4","gravatar_id":"","url":"https://api.github.com/users/dantman","html_url":"https://github.com/dantman","followers_url":"https://api.github.com/users/dantman/followers","following_url":"https://api.github.com/users/dantman/following{/other_user}","gists_url":"https://api.github.com/users/dantman/gists{/gist_id}","starred_url":"https://api.github.com/users/dantman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dantman/subscriptions","organizations_url":"https://api.github.com/users/dantman/orgs","repos_url":"https://api.github.com/users/dantman/repos","events_url":"https://api.github.com/users/dantman/events{/privacy}","received_events_url":"https://api.github.com/users/dantman/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dantman/react-native","description":"A framework for building native apps with React.","fork":true,"url":"https://api.github.com/repos/dantman/react-native","forks_url":"https://api.github.com/repos/dantman/react-native/forks","keys_url":"https://api.github.com/repos/dantman/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dantman/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dantman/react-native/teams","hooks_url":"https://api.github.com/repos/dantman/react-native/hooks","issue_events_url":"https://api.github.com/repos/dantman/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/dantman/react-native/events","assignees_url":"https://api.github.com/repos/dantman/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/dantman/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/dantman/react-native/tags","blobs_url":"https://api.github.com/repos/dantman/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dantman/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dantman/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/dantman/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dantman/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/dantman/react-native/languages","stargazers_url":"https://api.github.com/repos/dantman/react-native/stargazers","contributors_url":"https://api.github.com/repos/dantman/react-native/contributors","subscribers_url":"https://api.github.com/repos/dantman/react-native/subscribers","subscription_url":"https://api.github.com/repos/dantman/react-native/subscription","commits_url":"https://api.github.com/repos/dantman/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/dantman/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/dantman/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/dantman/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/dantman/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/dantman/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dantman/react-native/merges","archive_url":"https://api.github.com/repos/dantman/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dantman/react-native/downloads","issues_url":"https://api.github.com/repos/dantman/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/dantman/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/dantman/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/dantman/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dantman/react-native/labels{/name}","releases_url":"https://api.github.com/repos/dantman/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/dantman/react-native/deployments","created_at":"2016-02-19T08:45:19Z","updated_at":"2017-04-07T05:10:11Z","pushed_at":"2017-07-25T00:57:32Z","git_url":"git://github.com/dantman/react-native.git","ssh_url":"git@github.com:dantman/react-native.git","clone_url":"https://github.com/dantman/react-native.git","svn_url":"https://github.com/dantman/react-native","homepage":"http://facebook.github.io/react-native/","size":98549,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"65769b0c33a974d267bd48396bd7812b97d7607c","user":{"login":"facebook","id":69631,"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":29028775,"name":"react-native","full_name":"facebook/react-native","owner":{"login":"facebook","id":69631,"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-native","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/facebook/react-native","forks_url":"https://api.github.com/repos/facebook/react-native/forks","keys_url":"https://api.github.com/repos/facebook/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react-native/teams","hooks_url":"https://api.github.com/repos/facebook/react-native/hooks","issue_events_url":"https://api.github.com/repos/facebook/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react-native/events","assignees_url":"https://api.github.com/repos/facebook/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react-native/tags","blobs_url":"https://api.github.com/repos/facebook/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react-native/languages","stargazers_url":"https://api.github.com/repos/facebook/react-native/stargazers","contributors_url":"https://api.github.com/repos/facebook/react-native/contributors","subscribers_url":"https://api.github.com/repos/facebook/react-native/subscribers","subscription_url":"https://api.github.com/repos/facebook/react-native/subscription","commits_url":"https://api.github.com/repos/facebook/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react-native/merges","archive_url":"https://api.github.com/repos/facebook/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react-native/downloads","issues_url":"https://api.github.com/repos/facebook/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react-native/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react-native/deployments","created_at":"2015-01-09T18:10:16Z","updated_at":"2017-07-24T23:30:46Z","pushed_at":"2017-07-25T00:48:06Z","git_url":"git://github.com/facebook/react-native.git","ssh_url":"git@github.com:facebook/react-native.git","clone_url":"https://github.com/facebook/react-native.git","svn_url":"https://github.com/facebook/react-native","homepage":"http://facebook.github.io/react-native/","size":138652,"stargazers_count":51314,"watchers_count":51314,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":12017,"mirror_url":null,"open_issues_count":1075,"forks":12017,"open_issues":1075,"watchers":51314,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/15182"},"html":{"href":"https://github.com/facebook/react-native/pull/15182"},"issue":{"href":"https://api.github.com/repos/facebook/react-native/issues/15182"},"comments":{"href":"https://api.github.com/repos/facebook/react-native/issues/15182/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react-native/pulls/15182/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react-native/pulls/15182/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react-native/statuses/01fb46a698d65efe956f8b6c0fd8966cec360e06"}},"merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":10,"deletions":4,"changed_files":2}}
{"actor":{"display_login":"dantman"}}