{"action":"created","comment":{"url":"https://api.github.com/repos/airbnb/enzyme/pulls/comments/212701469","pull_request_review_id":149393981,"id":212701469,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMjcwMTQ2OQ==","diff_hunk":"@@ -0,0 +1,65 @@\n+import React from 'react';\n+import ReactDOM from 'react-dom';\n+\n+function getFiber(element) {\n+  const container = global.document.createElement('div');\n+  let inst = null;\n+  class Tester extends React.Component {\n+    render() {\n+      inst = this;\n+      return element;\n+    }\n+  }\n+  ReactDOM.render(React.createElement(Tester), container);\n+  return inst._reactInternalFiber.child;\n+}\n+\n+function detectFiberTags() {\n+  const supportsMode = typeof React.StrictMode !== 'undefined';\n+  const supportsContext = typeof React.createContext !== 'undefined';\n+  const supportsForwardRef = typeof React.forwardRef !== 'undefined';","path":"packages/enzyme-adapter-react-16/src/detectFiberTags.js","position":null,"original_position":20,"commit_id":"a96efb5f41692ccacd6436c9cf8e12de440d206d","original_commit_id":"13c47af31e27c2c9408031d577b32c81bfb628a6","user":{"login":"ljharb","id":45469,"node_id":"MDQ6VXNlcjQ1NDY5","avatar_url":"https://avatars1.githubusercontent.com/u/45469?v=4","gravatar_id":"","url":"https://api.github.com/users/ljharb","html_url":"https://github.com/ljharb","followers_url":"https://api.github.com/users/ljharb/followers","following_url":"https://api.github.com/users/ljharb/following{/other_user}","gists_url":"https://api.github.com/users/ljharb/gists{/gist_id}","starred_url":"https://api.github.com/users/ljharb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ljharb/subscriptions","organizations_url":"https://api.github.com/users/ljharb/orgs","repos_url":"https://api.github.com/users/ljharb/repos","events_url":"https://api.github.com/users/ljharb/events{/privacy}","received_events_url":"https://api.github.com/users/ljharb/received_events","type":"User","site_admin":false},"body":"I think that it's fine if things break with a mismatched react/react-dom - those have always had to match minor versions to work properly.","created_at":"2018-08-24T17:36:09Z","updated_at":"2018-08-24T17:36:09Z","html_url":"https://github.com/airbnb/enzyme/pull/1790#discussion_r212701469","pull_request_url":"https://api.github.com/repos/airbnb/enzyme/pulls/1790","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/comments/212701469"},"html":{"href":"https://github.com/airbnb/enzyme/pull/1790#discussion_r212701469"},"pull_request":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1790"}},"in_reply_to_id":212698989},"pull_request":{"url":"https://api.github.com/repos/airbnb/enzyme/pulls/1790","id":210800758,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwODAwNzU4","html_url":"https://github.com/airbnb/enzyme/pull/1790","diff_url":"https://github.com/airbnb/enzyme/pull/1790.diff","patch_url":"https://github.com/airbnb/enzyme/pull/1790.patch","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/1790","number":1790,"state":"open","locked":false,"title":"Detect Fiber types to avoid inlining constants","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 removes Enzyme's reliance on internal React reconciler constants which can change between releases (and *are* going to change in 16.4.3 which we plan to cut on Monday).\r\n\r\nInstead, we're feature testing to detect the Fiber tags. The fields I'm relying on are relatively stable, and are expected to stay significantly more stable than the constants. The detection is done lazily (because we can't assume the DOM is available until you call `mount`). I've checked that other code paths don't use `FiberTags`.\r\n\r\nThis should work with all 16.x versions. I did some manual checking with 16.1, 16.2, 16.3, and the master React version (which would break without this). I haven't verified 16.0 but I'd expect it to work as well.\r\n\r\nI included the revert of the reconciler dependency. This is because the code in it *does* rely on the constants (which we don't want). The inlined version here doesn't (because those constants are used only for invariants).\r\n\r\nLonger term, we should be able to get rid both of this inlined piece, and of the constant detection. Instead we should share the infrastructure with React DevTools. I expect that we'll get to it in the coming months, and when we do, I'll send a PR for that. In the meantime I'm happy to help with bugfixing the React adapter if you discover any problems with my approach.","created_at":"2018-08-24T17:23:12Z","updated_at":"2018-08-24T17:36:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6cf3329de124cecd128caf418b0bc1280621a4e2","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":320570650,"node_id":"MDU6TGFiZWwzMjA1NzA2NTA=","url":"https://api.github.com/repos/airbnb/enzyme/labels/PATCH","name":"PATCH","color":"bfe5bf","default":false},{"id":711847544,"node_id":"MDU6TGFiZWw3MTE4NDc1NDQ=","url":"https://api.github.com/repos/airbnb/enzyme/labels/package:%20react%20adapter:%2016","name":"package: react adapter: 16","color":"c5def5","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/airbnb/enzyme/pulls/1790/commits","review_comments_url":"https://api.github.com/repos/airbnb/enzyme/pulls/1790/comments","review_comment_url":"https://api.github.com/repos/airbnb/enzyme/pulls/comments{/number}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/1790/comments","statuses_url":"https://api.github.com/repos/airbnb/enzyme/statuses/a96efb5f41692ccacd6436c9cf8e12de440d206d","head":{"label":"gaearon:detect-types","ref":"detect-types","sha":"a96efb5f41692ccacd6436c9cf8e12de440d206d","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":87702780,"node_id":"MDEwOlJlcG9zaXRvcnk4NzcwMjc4MA==","name":"enzyme","full_name":"gaearon/enzyme","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/enzyme","description":"JavaScript Testing utilities for React","fork":true,"url":"https://api.github.com/repos/gaearon/enzyme","forks_url":"https://api.github.com/repos/gaearon/enzyme/forks","keys_url":"https://api.github.com/repos/gaearon/enzyme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gaearon/enzyme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gaearon/enzyme/teams","hooks_url":"https://api.github.com/repos/gaearon/enzyme/hooks","issue_events_url":"https://api.github.com/repos/gaearon/enzyme/issues/events{/number}","events_url":"https://api.github.com/repos/gaearon/enzyme/events","assignees_url":"https://api.github.com/repos/gaearon/enzyme/assignees{/user}","branches_url":"https://api.github.com/repos/gaearon/enzyme/branches{/branch}","tags_url":"https://api.github.com/repos/gaearon/enzyme/tags","blobs_url":"https://api.github.com/repos/gaearon/enzyme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gaearon/enzyme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gaearon/enzyme/git/refs{/sha}","trees_url":"https://api.github.com/repos/gaearon/enzyme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gaearon/enzyme/statuses/{sha}","languages_url":"https://api.github.com/repos/gaearon/enzyme/languages","stargazers_url":"https://api.github.com/repos/gaearon/enzyme/stargazers","contributors_url":"https://api.github.com/repos/gaearon/enzyme/contributors","subscribers_url":"https://api.github.com/repos/gaearon/enzyme/subscribers","subscription_url":"https://api.github.com/repos/gaearon/enzyme/subscription","commits_url":"https://api.github.com/repos/gaearon/enzyme/commits{/sha}","git_commits_url":"https://api.github.com/repos/gaearon/enzyme/git/commits{/sha}","comments_url":"https://api.github.com/repos/gaearon/enzyme/comments{/number}","issue_comment_url":"https://api.github.com/repos/gaearon/enzyme/issues/comments{/number}","contents_url":"https://api.github.com/repos/gaearon/enzyme/contents/{+path}","compare_url":"https://api.github.com/repos/gaearon/enzyme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gaearon/enzyme/merges","archive_url":"https://api.github.com/repos/gaearon/enzyme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gaearon/enzyme/downloads","issues_url":"https://api.github.com/repos/gaearon/enzyme/issues{/number}","pulls_url":"https://api.github.com/repos/gaearon/enzyme/pulls{/number}","milestones_url":"https://api.github.com/repos/gaearon/enzyme/milestones{/number}","notifications_url":"https://api.github.com/repos/gaearon/enzyme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gaearon/enzyme/labels{/name}","releases_url":"https://api.github.com/repos/gaearon/enzyme/releases{/id}","deployments_url":"https://api.github.com/repos/gaearon/enzyme/deployments","created_at":"2017-04-09T11:12:27Z","updated_at":"2018-01-21T19:24:00Z","pushed_at":"2018-08-24T17:35:39Z","git_url":"git://github.com/gaearon/enzyme.git","ssh_url":"git@github.com:gaearon/enzyme.git","clone_url":"https://github.com/gaearon/enzyme.git","svn_url":"https://github.com/gaearon/enzyme","homepage":"http://airbnb.io/enzyme/","size":1972,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"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":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"airbnb:master","ref":"master","sha":"fe3f8a58fd3c9cdc5534573196aa66ff188b5923","user":{"login":"airbnb","id":698437,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5ODQzNw==","avatar_url":"https://avatars3.githubusercontent.com/u/698437?v=4","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"repo":{"id":45942274,"node_id":"MDEwOlJlcG9zaXRvcnk0NTk0MjI3NA==","name":"enzyme","full_name":"airbnb/enzyme","owner":{"login":"airbnb","id":698437,"node_id":"MDEyOk9yZ2FuaXphdGlvbjY5ODQzNw==","avatar_url":"https://avatars3.githubusercontent.com/u/698437?v=4","gravatar_id":"","url":"https://api.github.com/users/airbnb","html_url":"https://github.com/airbnb","followers_url":"https://api.github.com/users/airbnb/followers","following_url":"https://api.github.com/users/airbnb/following{/other_user}","gists_url":"https://api.github.com/users/airbnb/gists{/gist_id}","starred_url":"https://api.github.com/users/airbnb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/airbnb/subscriptions","organizations_url":"https://api.github.com/users/airbnb/orgs","repos_url":"https://api.github.com/users/airbnb/repos","events_url":"https://api.github.com/users/airbnb/events{/privacy}","received_events_url":"https://api.github.com/users/airbnb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/airbnb/enzyme","description":"JavaScript Testing utilities for React","fork":false,"url":"https://api.github.com/repos/airbnb/enzyme","forks_url":"https://api.github.com/repos/airbnb/enzyme/forks","keys_url":"https://api.github.com/repos/airbnb/enzyme/keys{/key_id}","collaborators_url":"https://api.github.com/repos/airbnb/enzyme/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/airbnb/enzyme/teams","hooks_url":"https://api.github.com/repos/airbnb/enzyme/hooks","issue_events_url":"https://api.github.com/repos/airbnb/enzyme/issues/events{/number}","events_url":"https://api.github.com/repos/airbnb/enzyme/events","assignees_url":"https://api.github.com/repos/airbnb/enzyme/assignees{/user}","branches_url":"https://api.github.com/repos/airbnb/enzyme/branches{/branch}","tags_url":"https://api.github.com/repos/airbnb/enzyme/tags","blobs_url":"https://api.github.com/repos/airbnb/enzyme/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/airbnb/enzyme/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/airbnb/enzyme/git/refs{/sha}","trees_url":"https://api.github.com/repos/airbnb/enzyme/git/trees{/sha}","statuses_url":"https://api.github.com/repos/airbnb/enzyme/statuses/{sha}","languages_url":"https://api.github.com/repos/airbnb/enzyme/languages","stargazers_url":"https://api.github.com/repos/airbnb/enzyme/stargazers","contributors_url":"https://api.github.com/repos/airbnb/enzyme/contributors","subscribers_url":"https://api.github.com/repos/airbnb/enzyme/subscribers","subscription_url":"https://api.github.com/repos/airbnb/enzyme/subscription","commits_url":"https://api.github.com/repos/airbnb/enzyme/commits{/sha}","git_commits_url":"https://api.github.com/repos/airbnb/enzyme/git/commits{/sha}","comments_url":"https://api.github.com/repos/airbnb/enzyme/comments{/number}","issue_comment_url":"https://api.github.com/repos/airbnb/enzyme/issues/comments{/number}","contents_url":"https://api.github.com/repos/airbnb/enzyme/contents/{+path}","compare_url":"https://api.github.com/repos/airbnb/enzyme/compare/{base}...{head}","merges_url":"https://api.github.com/repos/airbnb/enzyme/merges","archive_url":"https://api.github.com/repos/airbnb/enzyme/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/airbnb/enzyme/downloads","issues_url":"https://api.github.com/repos/airbnb/enzyme/issues{/number}","pulls_url":"https://api.github.com/repos/airbnb/enzyme/pulls{/number}","milestones_url":"https://api.github.com/repos/airbnb/enzyme/milestones{/number}","notifications_url":"https://api.github.com/repos/airbnb/enzyme/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/airbnb/enzyme/labels{/name}","releases_url":"https://api.github.com/repos/airbnb/enzyme/releases{/id}","deployments_url":"https://api.github.com/repos/airbnb/enzyme/deployments","created_at":"2015-11-10T21:45:38Z","updated_at":"2018-08-24T17:35:17Z","pushed_at":"2018-08-24T17:35:41Z","git_url":"git://github.com/airbnb/enzyme.git","ssh_url":"git@github.com:airbnb/enzyme.git","clone_url":"https://github.com/airbnb/enzyme.git","svn_url":"https://github.com/airbnb/enzyme","homepage":"http://airbnb.io/enzyme/","size":5080,"stargazers_count":14940,"watchers_count":14940,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":1613,"mirror_url":null,"archived":false,"open_issues_count":171,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":1613,"open_issues":171,"watchers":14940,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1790"},"html":{"href":"https://github.com/airbnb/enzyme/pull/1790"},"issue":{"href":"https://api.github.com/repos/airbnb/enzyme/issues/1790"},"comments":{"href":"https://api.github.com/repos/airbnb/enzyme/issues/1790/comments"},"review_comments":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1790/comments"},"review_comment":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/airbnb/enzyme/pulls/1790/commits"},"statuses":{"href":"https://api.github.com/repos/airbnb/enzyme/statuses/a96efb5f41692ccacd6436c9cf8e12de440d206d"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ljharb"}}