{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/3451","labels_url":"https://api.github.com/repos/facebook/react/issues/3451/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/3451/comments","events_url":"https://api.github.com/repos/facebook/react/issues/3451/events","html_url":"https://github.com/facebook/react/issues/3451","id":62706905,"number":3451,"title":"Wrong context warning? - 'Warning: owner-based and parent-based contexts differ'","user":{"login":"davidagraf","id":317475,"avatar_url":"https://avatars.githubusercontent.com/u/317475?v=3","gravatar_id":"","url":"https://api.github.com/users/davidagraf","html_url":"https://github.com/davidagraf","followers_url":"https://api.github.com/users/davidagraf/followers","following_url":"https://api.github.com/users/davidagraf/following{/other_user}","gists_url":"https://api.github.com/users/davidagraf/gists{/gist_id}","starred_url":"https://api.github.com/users/davidagraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidagraf/subscriptions","organizations_url":"https://api.github.com/users/davidagraf/orgs","repos_url":"https://api.github.com/users/davidagraf/repos","events_url":"https://api.github.com/users/davidagraf/events{/privacy}","received_events_url":"https://api.github.com/users/davidagraf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-18T14:27:24Z","updated_at":"2015-03-18T18:23:33Z","closed_at":null,"body":"IMO: the warning ...\r\n\r\n    Warning: owner-based and parent-based contexts differ (values: `context value` vs `undefined`) for key (foo) while mounting Child (see: http://fb.me/react-context-by-parent)\r\n\r\n... in the following code is wrong. \r\n\r\nIn the code, I define a root component with a context value. The root component show two different children dependent on a state variable. When the root switched from one child to another, the warning is shown.\r\n\r\nExample on jsFiddle: http://jsfiddle.net/davidagraf/548u0o0a/\r\n\r\nRun tested with React v0.13.1.\r\n\r\n```JS\r\nvar Root = React.createClass({\r\n  childContextTypes: {\r\n    foo: React.PropTypes.string\r\n  },\r\n  getChildContext: function() {\r\n    return {\r\n        foo: \"context value\"\r\n    };\r\n  },\r\n  getInitialState: function () {\r\n    return {foo: false};\r\n  },\r\n  render: function() {\r\n    if (this.state.foo) {\r\n      return <Child/>;\r\n    } else {\r\n      setTimeout(function() { this.setState({foo: true}); }.bind(this), 1000);\r\n      //return <Child/>;\r\n      return <div>loading</div>;\r\n    }\r\n  }\r\n});\r\n\r\nvar Child = React.createClass({\r\n  contextTypes: {\r\n    foo: React.PropTypes.string\r\n  },\r\n  render: function() {\r\n    return <div>{this.context.foo}</div>;\r\n  }\r\n});\r\n\r\nReact.render(<Root/>, document.body);\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/83110224","html_url":"https://github.com/facebook/react/issues/3451#issuecomment-83110224","issue_url":"https://api.github.com/repos/facebook/react/issues/3451","id":83110224,"user":{"login":"zpao","id":8445,"avatar_url":"https://avatars.githubusercontent.com/u/8445?v=3","gravatar_id":"","url":"https://api.github.com/users/zpao","html_url":"https://github.com/zpao","followers_url":"https://api.github.com/users/zpao/followers","following_url":"https://api.github.com/users/zpao/following{/other_user}","gists_url":"https://api.github.com/users/zpao/gists{/gist_id}","starred_url":"https://api.github.com/users/zpao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zpao/subscriptions","organizations_url":"https://api.github.com/users/zpao/orgs","repos_url":"https://api.github.com/users/zpao/repos","events_url":"https://api.github.com/users/zpao/events{/privacy}","received_events_url":"https://api.github.com/users/zpao/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T18:23:33Z","updated_at":"2015-03-18T18:23:33Z","body":"cc @jsfb - I'm not following the plans for context, can you confirm."}}