{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/react/pulls/comments/43463265","id":43463265,"diff_hunk":"@@ -1241,4 +1241,53 @@ describe('ReactCompositeComponent', function() {\n \n   });\n \n+  it('should not overwrite mutated properties', function() {\n+    function Moo(props) {\n+      React.Component.call(this, props);\n+    }\n+    Moo.prototype = Object.create(React.Component.prototype, {\n+      constructor: {\n+        value: Moo,\n+      },\n+    });\n+    Moo.prototype.render = function() {\n+      return <span />;\n+    };\n+    Moo.defaultProps = { idx: 'moo' };\n+\n+    function Foo(props) {\n+      var _props = { idx: this.constructor.defaultProps.idx + '?' };\n+\n+      React.Component.call(this, _props);\n+    }\n+    Foo.prototype = Object.create(React.Component.prototype, {\n+      constructor: {\n+        value: Foo,\n+      },\n+    });\n+    Foo.prototype.render = function() {\n+      return <span />;\n+    };\n+    Foo.defaultProps = { idx: 'foo' };\n+\n+    function Bar() {\n+      Foo.call(this);\n+    }\n+\n+    Bar.prototype = Object.create(Foo.prototype, {\n+      constructor: {\n+        value: Bar,\n+      },\n+    });\n+    Bar.defaultProps = { idx: 'bar' };","path":"src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js","position":42,"original_position":42,"commit_id":"c341269ab28924af1901e6b559515690bde973a4","original_commit_id":"c341269ab28924af1901e6b559515690bde973a4","user":{"login":"jimfb","id":9595985,"avatar_url":"https://avatars.githubusercontent.com/u/9595985?v=3","gravatar_id":"","url":"https://api.github.com/users/jimfb","html_url":"https://github.com/jimfb","followers_url":"https://api.github.com/users/jimfb/followers","following_url":"https://api.github.com/users/jimfb/following{/other_user}","gists_url":"https://api.github.com/users/jimfb/gists{/gist_id}","starred_url":"https://api.github.com/users/jimfb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimfb/subscriptions","organizations_url":"https://api.github.com/users/jimfb/orgs","repos_url":"https://api.github.com/users/jimfb/repos","events_url":"https://api.github.com/users/jimfb/events{/privacy}","received_events_url":"https://api.github.com/users/jimfb/received_events","type":"User","site_admin":false},"body":"Yeah, I agree, that would be better.  @drdelambre Would you mind updating this diff?","created_at":"2015-10-30T01:03:46Z","updated_at":"2015-10-30T01:03:46Z","html_url":"https://github.com/facebook/react/pull/5320#discussion_r43463265","pull_request_url":"https://api.github.com/repos/facebook/react/pulls/5320","_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/comments/43463265"},"html":{"href":"https://github.com/facebook/react/pull/5320#discussion_r43463265"},"pull_request":{"href":"https://api.github.com/repos/facebook/react/pulls/5320"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/5320","id":49104336,"html_url":"https://github.com/facebook/react/pull/5320","diff_url":"https://github.com/facebook/react/pull/5320.diff","patch_url":"https://github.com/facebook/react/pull/5320.patch","issue_url":"https://api.github.com/repos/facebook/react/issues/5320","number":5320,"state":"open","locked":false,"title":"Overwriting of mutated props in constructor","user":{"login":"drdelambre","id":1434802,"avatar_url":"https://avatars.githubusercontent.com/u/1434802?v=3","gravatar_id":"","url":"https://api.github.com/users/drdelambre","html_url":"https://github.com/drdelambre","followers_url":"https://api.github.com/users/drdelambre/followers","following_url":"https://api.github.com/users/drdelambre/following{/other_user}","gists_url":"https://api.github.com/users/drdelambre/gists{/gist_id}","starred_url":"https://api.github.com/users/drdelambre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drdelambre/subscriptions","organizations_url":"https://api.github.com/users/drdelambre/orgs","repos_url":"https://api.github.com/users/drdelambre/repos","events_url":"https://api.github.com/users/drdelambre/events{/privacy}","received_events_url":"https://api.github.com/users/drdelambre/received_events","type":"User","site_admin":false},"body":"When rendering the class ```Bar``` from the following example, the ```Bar``` instance has the moo prop set as 'BOO' and not the expected 'BOO!' because the props passed to the constructor are overwritten with their initial state in the chance they are undefined. This PR just ignores that logic if props is defined.\r\n\r\n```Javascript\r\nclass Foo extends React.Component {\r\n  constructor(props) {\r\n    var _props = { moo: new.target.defaultProps.moo + '!' }\r\n    super(_props);\r\n  }\r\n}\r\nFoo.defaultProps = { moo: 'MOO' };\r\n\r\nclass Bar extends Foo {}\r\nBar.defaultProps = { moo: 'BOO' };\r\n```\r\n","created_at":"2015-10-29T06:51:52Z","updated_at":"2015-10-30T01:03:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88e8e309965f85ac28650cbbea5cbbe7662dff0f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react/pulls/5320/commits","review_comments_url":"https://api.github.com/repos/facebook/react/pulls/5320/comments","review_comment_url":"https://api.github.com/repos/facebook/react/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react/issues/5320/comments","statuses_url":"https://api.github.com/repos/facebook/react/statuses/c341269ab28924af1901e6b559515690bde973a4","head":{"label":"drdelambre:overwrite_props","ref":"overwrite_props","sha":"c341269ab28924af1901e6b559515690bde973a4","user":{"login":"drdelambre","id":1434802,"avatar_url":"https://avatars.githubusercontent.com/u/1434802?v=3","gravatar_id":"","url":"https://api.github.com/users/drdelambre","html_url":"https://github.com/drdelambre","followers_url":"https://api.github.com/users/drdelambre/followers","following_url":"https://api.github.com/users/drdelambre/following{/other_user}","gists_url":"https://api.github.com/users/drdelambre/gists{/gist_id}","starred_url":"https://api.github.com/users/drdelambre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drdelambre/subscriptions","organizations_url":"https://api.github.com/users/drdelambre/orgs","repos_url":"https://api.github.com/users/drdelambre/repos","events_url":"https://api.github.com/users/drdelambre/events{/privacy}","received_events_url":"https://api.github.com/users/drdelambre/received_events","type":"User","site_admin":false},"repo":{"id":45161688,"name":"react","full_name":"drdelambre/react","owner":{"login":"drdelambre","id":1434802,"avatar_url":"https://avatars.githubusercontent.com/u/1434802?v=3","gravatar_id":"","url":"https://api.github.com/users/drdelambre","html_url":"https://github.com/drdelambre","followers_url":"https://api.github.com/users/drdelambre/followers","following_url":"https://api.github.com/users/drdelambre/following{/other_user}","gists_url":"https://api.github.com/users/drdelambre/gists{/gist_id}","starred_url":"https://api.github.com/users/drdelambre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drdelambre/subscriptions","organizations_url":"https://api.github.com/users/drdelambre/orgs","repos_url":"https://api.github.com/users/drdelambre/repos","events_url":"https://api.github.com/users/drdelambre/events{/privacy}","received_events_url":"https://api.github.com/users/drdelambre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/drdelambre/react","description":"A declarative, efficient, and flexible JavaScript library for building user interfaces.","fork":true,"url":"https://api.github.com/repos/drdelambre/react","forks_url":"https://api.github.com/repos/drdelambre/react/forks","keys_url":"https://api.github.com/repos/drdelambre/react/keys{/key_id}","collaborators_url":"https://api.github.com/repos/drdelambre/react/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/drdelambre/react/teams","hooks_url":"https://api.github.com/repos/drdelambre/react/hooks","issue_events_url":"https://api.github.com/repos/drdelambre/react/issues/events{/number}","events_url":"https://api.github.com/repos/drdelambre/react/events","assignees_url":"https://api.github.com/repos/drdelambre/react/assignees{/user}","branches_url":"https://api.github.com/repos/drdelambre/react/branches{/branch}","tags_url":"https://api.github.com/repos/drdelambre/react/tags","blobs_url":"https://api.github.com/repos/drdelambre/react/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/drdelambre/react/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/drdelambre/react/git/refs{/sha}","trees_url":"https://api.github.com/repos/drdelambre/react/git/trees{/sha}","statuses_url":"https://api.github.com/repos/drdelambre/react/statuses/{sha}","languages_url":"https://api.github.com/repos/drdelambre/react/languages","stargazers_url":"https://api.github.com/repos/drdelambre/react/stargazers","contributors_url":"https://api.github.com/repos/drdelambre/react/contributors","subscribers_url":"https://api.github.com/repos/drdelambre/react/subscribers","subscription_url":"https://api.github.com/repos/drdelambre/react/subscription","commits_url":"https://api.github.com/repos/drdelambre/react/commits{/sha}","git_commits_url":"https://api.github.com/repos/drdelambre/react/git/commits{/sha}","comments_url":"https://api.github.com/repos/drdelambre/react/comments{/number}","issue_comment_url":"https://api.github.com/repos/drdelambre/react/issues/comments{/number}","contents_url":"https://api.github.com/repos/drdelambre/react/contents/{+path}","compare_url":"https://api.github.com/repos/drdelambre/react/compare/{base}...{head}","merges_url":"https://api.github.com/repos/drdelambre/react/merges","archive_url":"https://api.github.com/repos/drdelambre/react/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/drdelambre/react/downloads","issues_url":"https://api.github.com/repos/drdelambre/react/issues{/number}","pulls_url":"https://api.github.com/repos/drdelambre/react/pulls{/number}","milestones_url":"https://api.github.com/repos/drdelambre/react/milestones{/number}","notifications_url":"https://api.github.com/repos/drdelambre/react/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/drdelambre/react/labels{/name}","releases_url":"https://api.github.com/repos/drdelambre/react/releases{/id}","created_at":"2015-10-29T05:12:30Z","updated_at":"2015-10-29T05:12:37Z","pushed_at":"2015-10-29T23:17:08Z","git_url":"git://github.com/drdelambre/react.git","ssh_url":"git@github.com:drdelambre/react.git","clone_url":"https://github.com/drdelambre/react.git","svn_url":"https://github.com/drdelambre/react","homepage":"https://facebook.github.io/react/","size":68661,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"01341480c2f32d8ae429f77b2b9bae8d70587819","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","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,"name":"react","full_name":"facebook/react","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","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}","created_at":"2013-05-24T16:15:54Z","updated_at":"2015-10-30T00:57:32Z","pushed_at":"2015-10-30T00:54:18Z","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://facebook.github.io/react/","size":121212,"stargazers_count":30420,"watchers_count":30420,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4729,"mirror_url":null,"open_issues_count":585,"forks":4729,"open_issues":585,"watchers":30420,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react/pulls/5320"},"html":{"href":"https://github.com/facebook/react/pull/5320"},"issue":{"href":"https://api.github.com/repos/facebook/react/issues/5320"},"comments":{"href":"https://api.github.com/repos/facebook/react/issues/5320/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react/pulls/5320/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react/pulls/5320/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react/statuses/c341269ab28924af1901e6b559515690bde973a4"}}}}