{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react/pulls/comments/194500536","pull_request_review_id":127678644,"id":194500536,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NDUwMDUzNg==","diff_hunk":"@@ -200,8 +200,45 @@ const validWrapperTypes = new Set([\n   ClassComponent,\n   HostComponent,\n   ForwardRef,\n+  // Normally skipped, but used when there's more than one root child.\n+  HostRoot,\n ]);\n \n+function getChildren(parent: Fiber) {\n+  const children = [];\n+  const startingNode = parent;\n+  let node: Fiber = startingNode;\n+  if (node.child === null) {\n+    return children;\n+  }\n+  node.child.return = node;\n+  node = node.child;\n+  outer: while (true) {\n+    let descend = false;\n+    if (validWrapperTypes.has(node.tag)) {\n+      children.push(wrapFiber(node));\n+    } else if (node.tag === HostText) {\n+      children.push('' + node.memoizedProps);\n+    } else {\n+      descend = true;\n+    }\n+    if (descend && node.child !== null) {\n+      node.child.return = node;\n+      node = node.child;\n+      continue;\n+    }\n+    while (node.sibling === null) {\n+      if (node.return === startingNode) {\n+        break outer;\n+      }\n+      node = (node.return: any);\n+    }\n+    (node.sibling: any).return = node.return;\n+    node = (node.sibling: any);\n+  }","path":"packages/react-test-renderer/src/ReactTestRenderer.js","position":39,"original_position":39,"commit_id":"c99ae2e1f092fd4bc5037d2ce8557d13d41392d5","original_commit_id":"c99ae2e1f092fd4bc5037d2ce8557d13d41392d5","user":{"login":"flarnie","id":1114467,"node_id":"MDQ6VXNlcjExMTQ0Njc=","avatar_url":"https://avatars2.githubusercontent.com/u/1114467?v=4","gravatar_id":"","url":"https://api.github.com/users/flarnie","html_url":"https://github.com/flarnie","followers_url":"https://api.github.com/users/flarnie/followers","following_url":"https://api.github.com/users/flarnie/following{/other_user}","gists_url":"https://api.github.com/users/flarnie/gists{/gist_id}","starred_url":"https://api.github.com/users/flarnie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flarnie/subscriptions","organizations_url":"https://api.github.com/users/flarnie/orgs","repos_url":"https://api.github.com/users/flarnie/repos","events_url":"https://api.github.com/users/flarnie/events{/privacy}","received_events_url":"https://api.github.com/users/flarnie/received_events","type":"User","site_admin":false},"body":"I'm sure it will become clear as I continue reading, but I was surprised that this method mutates the nodes and goes down to potentially get deeply nested children.","created_at":"2018-06-11T18:24:00Z","updated_at":"2018-06-11T18:38:36Z","html_url":"https://github.com/facebook/react/pull/13017#discussion_r194500536","pull_request_url":"https://api.github.com/repos/facebook/react/pulls/13017","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/comments/194500536"},"html":{"href":"https://github.com/facebook/react/pull/13017#discussion_r194500536"},"pull_request":{"href":"https://api.github.com/repos/facebook/react/pulls/13017"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/13017","id":194014571,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk0MDE0NTcx","html_url":"https://github.com/facebook/react/pull/13017","diff_url":"https://github.com/facebook/react/pull/13017.diff","patch_url":"https://github.com/facebook/react/pull/13017.patch","issue_url":"https://api.github.com/repos/facebook/react/issues/13017","number":13017,"state":"open","locked":false,"title":"Allow multiple root children in test renderer traversal API","user":{"login":"gaearon","id":810438,"node_id":"MDQ6VXNlcjgxMDQzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/810438?v=4","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"body":"This should fix some bugs @sahrens was seeing.\r\n\r\nTest renderer traversal API currently treats \"fragmenty\" nodes (fragments, providers, modes) as passthrough. That usually works, but it breaks down at the top level. The `.root` node has to point to a Fiber, so if it's a \"passthrough\" Fiber, we currently invariant.\r\n\r\nIdeally I think the root node should have always been a special kind of \"root\" whose `type` and `props` don't match the nearest \"materialized\" node. But that ship has sailed, and changing this would be breaking.\r\n\r\nSo for now I want to enable those use cases by only \"materializing\" a special root node (with `type: null, props: null`) when it has multiple children.\r\n\r\nIt should be mostly additive because that kind of code used to throw. It *does* change the behavior for a top-level non-keyed fragment (we used to ignore all children but the first) but this actually sounds like a bugfix to me, especially given that subsequent children were *not* ignored in the `toJSON()` API.\r\n\r\nIn the future, we probably should change `.root` to always be a special node, regardless of whether it has one or more children.","created_at":"2018-06-11T15:14:44Z","updated_at":"2018-06-11T18:38:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2befd04b2f82ae74c870c49f42580dcc65e27a91","assignee":null,"assignees":[],"requested_reviewers":[{"login":"sophiebits","id":6820,"node_id":"MDQ6VXNlcjY4MjA=","avatar_url":"https://avatars2.githubusercontent.com/u/6820?v=4","gravatar_id":"","url":"https://api.github.com/users/sophiebits","html_url":"https://github.com/sophiebits","followers_url":"https://api.github.com/users/sophiebits/followers","following_url":"https://api.github.com/users/sophiebits/following{/other_user}","gists_url":"https://api.github.com/users/sophiebits/gists{/gist_id}","starred_url":"https://api.github.com/users/sophiebits/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sophiebits/subscriptions","organizations_url":"https://api.github.com/users/sophiebits/orgs","repos_url":"https://api.github.com/users/sophiebits/repos","events_url":"https://api.github.com/users/sophiebits/events{/privacy}","received_events_url":"https://api.github.com/users/sophiebits/received_events","type":"User","site_admin":false},{"login":"bvaughn","id":29597,"node_id":"MDQ6VXNlcjI5NTk3","avatar_url":"https://avatars0.githubusercontent.com/u/29597?v=4","gravatar_id":"","url":"https://api.github.com/users/bvaughn","html_url":"https://github.com/bvaughn","followers_url":"https://api.github.com/users/bvaughn/followers","following_url":"https://api.github.com/users/bvaughn/following{/other_user}","gists_url":"https://api.github.com/users/bvaughn/gists{/gist_id}","starred_url":"https://api.github.com/users/bvaughn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bvaughn/subscriptions","organizations_url":"https://api.github.com/users/bvaughn/orgs","repos_url":"https://api.github.com/users/bvaughn/repos","events_url":"https://api.github.com/users/bvaughn/events{/privacy}","received_events_url":"https://api.github.com/users/bvaughn/received_events","type":"User","site_admin":false}],"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/13017/commits","review_comments_url":"https://api.github.com/repos/facebook/react/pulls/13017/comments","review_comment_url":"https://api.github.com/repos/facebook/react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react/issues/13017/comments","statuses_url":"https://api.github.com/repos/facebook/react/statuses/c99ae2e1f092fd4bc5037d2ce8557d13d41392d5","head":{"label":"gaearon:root-stuff","ref":"root-stuff","sha":"c99ae2e1f092fd4bc5037d2ce8557d13d41392d5","user":{"login":"gaearon","id":810438,"node_id":"MDQ6VXNlcjgxMDQzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/810438?v=4","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"repo":{"id":71563876,"node_id":"MDEwOlJlcG9zaXRvcnk3MTU2Mzg3Ng==","name":"react","full_name":"gaearon/react","owner":{"login":"gaearon","id":810438,"node_id":"MDQ6VXNlcjgxMDQzOA==","avatar_url":"https://avatars0.githubusercontent.com/u/810438?v=4","gravatar_id":"","url":"https://api.github.com/users/gaearon","html_url":"https://github.com/gaearon","followers_url":"https://api.github.com/users/gaearon/followers","following_url":"https://api.github.com/users/gaearon/following{/other_user}","gists_url":"https://api.github.com/users/gaearon/gists{/gist_id}","starred_url":"https://api.github.com/users/gaearon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaearon/subscriptions","organizations_url":"https://api.github.com/users/gaearon/orgs","repos_url":"https://api.github.com/users/gaearon/repos","events_url":"https://api.github.com/users/gaearon/events{/privacy}","received_events_url":"https://api.github.com/users/gaearon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gaearon/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":true,"url":"https://api.github.com/repos/gaearon/react","forks_url":"https://api.github.com/repos/gaearon/react/forks","keys_url":"https://api.github.com/repos/gaearon/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gaearon/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gaearon/react/teams","hooks_url":"https://api.github.com/repos/gaearon/react/hooks","issue_events_url":"https://api.github.com/repos/gaearon/react/issues/events{/number}","events_url":"https://api.github.com/repos/gaearon/react/events","assignees_url":"https://api.github.com/repos/gaearon/react/assignees{/user}","branches_url":"https://api.github.com/repos/gaearon/react/branches{/branch}","tags_url":"https://api.github.com/repos/gaearon/react/tags","blobs_url":"https://api.github.com/repos/gaearon/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gaearon/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gaearon/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/gaearon/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gaearon/react/statuses/{sha}","languages_url":"https://api.github.com/repos/gaearon/react/languages","stargazers_url":"https://api.github.com/repos/gaearon/react/stargazers","contributors_url":"https://api.github.com/repos/gaearon/react/contributors","subscribers_url":"https://api.github.com/repos/gaearon/react/subscribers","subscription_url":"https://api.github.com/repos/gaearon/react/subscription","commits_url":"https://api.github.com/repos/gaearon/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/gaearon/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/gaearon/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/gaearon/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/gaearon/react/contents/{+path}","compare_url":"https://api.github.com/repos/gaearon/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gaearon/react/merges","archive_url":"https://api.github.com/repos/gaearon/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gaearon/react/downloads","issues_url":"https://api.github.com/repos/gaearon/react/issues{/number}","pulls_url":"https://api.github.com/repos/gaearon/react/pulls{/number}","milestones_url":"https://api.github.com/repos/gaearon/react/milestones{/number}","notifications_url":"https://api.github.com/repos/gaearon/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gaearon/react/labels{/name}","releases_url":"https://api.github.com/repos/gaearon/react/releases{/id}","deployments_url":"https://api.github.com/repos/gaearon/react/deployments","created_at":"2016-10-21T12:39:49Z","updated_at":"2018-03-20T00:21:48Z","pushed_at":"2018-06-11T17:28:46Z","git_url":"git://github.com/gaearon/react.git","ssh_url":"git@github.com:gaearon/react.git","clone_url":"https://github.com/gaearon/react.git","svn_url":"https://github.com/gaearon/react","homepage":"https://facebook.github.io/react/","size":96828,"stargazers_count":7,"watchers_count":7,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":4,"open_issues":0,"watchers":7,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"d480782c4162431d06c077ebf8fdf6b8ba7896ef","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-06-11T18:15:27Z","pushed_at":"2018-06-11T17:28:51Z","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":136376,"stargazers_count":98032,"watchers_count":98032,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18440,"mirror_url":null,"archived":false,"open_issues_count":480,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":18440,"open_issues":480,"watchers":98032,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/13017"},"html":{"href":"https://github.com/facebook/react/pull/13017"},"issue":{"href":"https://api.github.com/repos/facebook/react/issues/13017"},"comments":{"href":"https://api.github.com/repos/facebook/react/issues/13017/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react/pulls/13017/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react/pulls/13017/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react/statuses/c99ae2e1f092fd4bc5037d2ce8557d13d41392d5"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"flarnie"}}