Description
It seems that if a component implementing getChildContext
is updated to render a different (top-level) child, react doesn't call getChildContext
on that updated component (for parent-based context). So the new child will effectively get the context of its grandparent instead (if there is one).
While this doesn't seem to break anything (I assume that is because react still prioritizes owner-based context which works fine), it leads to a "contexts differ" warning.
Here's a fiddle: http://jsfiddle.net/2fd0jvo5/10/
Once you click "Show Foo", you should see a warning in the console. When wrapping the render output with a static element such as <span>
, the warning will not appear.
I'm not very familiar with the source code, but for what it's worth, the warning goes away if I replace this line with this._processChildContext(context)
.