From 5ebcd9d89b223886382afc8552d13e6098bc30f2 Mon Sep 17 00:00:00 2001 From: Jim Date: Mon, 1 Jun 2015 16:45:55 -0700 Subject: [PATCH] Removed ReactContext (cleanup) --- .../__tests__/ReactContextValidator-test.js | 12 +++---- .../reconciler/ReactCompositeComponent.js | 6 ---- .../shared/reconciler/ReactContext.js | 32 ------------------- 3 files changed, 4 insertions(+), 46 deletions(-) delete mode 100644 src/renderers/shared/reconciler/ReactContext.js diff --git a/src/isomorphic/classic/__tests__/ReactContextValidator-test.js b/src/isomorphic/classic/__tests__/ReactContextValidator-test.js index d7252a3f9c..b6799bbda2 100644 --- a/src/isomorphic/classic/__tests__/ReactContextValidator-test.js +++ b/src/isomorphic/classic/__tests__/ReactContextValidator-test.js @@ -216,20 +216,16 @@ describe('ReactContextValidator', function() { }); ReactTestUtils.renderIntoDocument(); - expect(console.error.argsForCall.length).toBe(2); + expect(console.error.argsForCall.length).toBe(1); expect(console.error.argsForCall[0][0]).toBe( 'Warning: Failed Context Types: ' + 'Required child context `foo` was not specified in `Component`.' ); - expect(console.error.argsForCall[1][0]).toBe( - 'Warning: Failed Context Types: ' + - 'Required child context `foo` was not specified in `Component`.' - ); ReactTestUtils.renderIntoDocument(); - expect(console.error.argsForCall.length).toBe(4); - expect(console.error.argsForCall[3][0]).toBe( + expect(console.error.argsForCall.length).toBe(2); + expect(console.error.argsForCall[1][0]).toBe( 'Warning: Failed Context Types: ' + 'Invalid child context `foo` of type `number` ' + 'supplied to `Component`, expected `string`.' @@ -244,7 +240,7 @@ describe('ReactContextValidator', function() { ); // Previous calls should not log errors - expect(console.error.argsForCall.length).toBe(4); + expect(console.error.argsForCall.length).toBe(2); }); }); diff --git a/src/renderers/shared/reconciler/ReactCompositeComponent.js b/src/renderers/shared/reconciler/ReactCompositeComponent.js index 11806131b8..93306ce228 100644 --- a/src/renderers/shared/reconciler/ReactCompositeComponent.js +++ b/src/renderers/shared/reconciler/ReactCompositeComponent.js @@ -12,7 +12,6 @@ 'use strict'; var ReactComponentEnvironment = require('ReactComponentEnvironment'); -var ReactContext = require('ReactContext'); var ReactCurrentOwner = require('ReactCurrentOwner'); var ReactElement = require('ReactElement'); var ReactElementValidator = require('ReactElementValidator'); @@ -756,16 +755,11 @@ var ReactCompositeComponentMixin = { */ _renderValidatedComponent: function() { var renderedComponent; - var previousContext = ReactContext.current; - ReactContext.current = this._processChildContext( - this._currentElement._context - ); ReactCurrentOwner.current = this; try { renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext(); } finally { - ReactContext.current = previousContext; ReactCurrentOwner.current = null; } invariant( diff --git a/src/renderers/shared/reconciler/ReactContext.js b/src/renderers/shared/reconciler/ReactContext.js deleted file mode 100644 index 75cc7c4d0d..0000000000 --- a/src/renderers/shared/reconciler/ReactContext.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright 2013-2015, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * @providesModule ReactContext - */ - -'use strict'; - -var emptyObject = require('emptyObject'); - -/** - * Keeps track of the current context. - * - * The context is automatically passed down the component ownership hierarchy - * and is accessible via `this.context` on ReactCompositeComponents. - */ -var ReactContext = { - - /** - * @internal - * @type {object} - */ - current: emptyObject - -}; - -module.exports = ReactContext;