diff --git a/src/renderers/shared/reconciler/ReactReconciler.js b/src/renderers/shared/reconciler/ReactReconciler.js
index e8c757ba27b5..8e4a140c689d 100644
--- a/src/renderers/shared/reconciler/ReactReconciler.js
+++ b/src/renderers/shared/reconciler/ReactReconciler.js
@@ -66,8 +66,8 @@ var ReactReconciler = {
) {
var prevElement = internalInstance._currentElement;
if (nextElement === prevElement &&
- nextElement._owner != null
- // TODO: Shouldn't we need to do this: `&& context === internalInstance._context`
+ nextElement._owner != null &&
+ context === internalInstance._context
) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
diff --git a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
index 63f7c4740797..6f479f5a4065 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactCompositeComponent-test.js
@@ -667,6 +667,68 @@ describe('ReactCompositeComponent', function() {
reactComponentExpect(childInstance).scalarContextEqual({foo: 'bar', flag: true});
});
+ it('should pass context when re-rendered for static child within a composite component', function() {
+ var Parent = React.createClass({
+ childContextTypes: {
+ flag: ReactPropTypes.bool,
+ },
+
+ getChildContext() {
+ return {
+ flag: this.state.flag,
+ };
+ },
+
+ getInitialState: function() {
+ return {
+ flag: true,
+ };
+ },
+
+ render() {
+ return
{this.props.children}
;
+ },
+
+ });
+
+ var Child = React.createClass({
+ contextTypes: {
+ flag: ReactPropTypes.bool,
+ },
+
+ render: function() {
+ return ;
+ },
+ });
+
+ var Wrapper = React.createClass({
+ render() {
+ return (
+
+
+
+ );
+ },
+ });
+
+
+ var wrapper = ReactTestUtils.renderIntoDocument(
+
+ );
+
+ expect(wrapper.refs.parent.state.flag).toEqual(true);
+ reactComponentExpect(wrapper.refs.child).scalarContextEqual({flag: true});
+
+ // We update while is still a static prop relative to this update
+ wrapper.refs.parent.setState({flag: false});
+
+ expect(console.error.argsForCall.length).toBe(0);
+
+ expect(wrapper.refs.parent.state.flag).toEqual(false);
+ reactComponentExpect(wrapper.refs.child).scalarContextEqual({flag: false});
+
+ });
+
it('should pass context transitively', function() {
var childInstance = null;
var grandchildInstance = null;
diff --git a/src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js b/src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
index 45b28fdcb987..22f0b3a75bad 100644
--- a/src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
+++ b/src/renderers/shared/reconciler/__tests__/ReactUpdates-test.js
@@ -433,10 +433,15 @@ describe('ReactUpdates', function() {
root = ReactTestUtils.renderIntoDocument(root);
function expectUpdates(desiredWillUpdates, desiredDidUpdates) {
- expect(willUpdates).toEqual(desiredWillUpdates);
- expect(didUpdates).toEqual(desiredDidUpdates);
- willUpdates.length = 0;
- didUpdates.length = 0;
+ var i;
+ for (i = 0; i < desiredWillUpdates; i++) {
+ expect(willUpdates).toContain(desiredWillUpdates[i]);
+ }
+ for (i = 0; i < desiredDidUpdates; i++) {
+ expect(didUpdates).toContain(desiredDidUpdates[i]);
+ }
+ willUpdates = [];
+ didUpdates = [];
}
function triggerUpdate(c) {