Removed ReactContext (cleanup)
Jim committed
Jun 1, 2015 at 16:45 UTC
5ebcd9d89b223886382afc8552d13e6098bc30f2
3 files changed
+4
-46
src/isomorphic/classic/__tests__/ReactContextValidator-test.js
+4
-8
@@ -216,20 +216,16 @@ describe('ReactContextValidator', function() {
216
});
217
218
ReactTestUtils.renderIntoDocument(<Component testContext={{bar: 123}} />);
219
- expect(console.error.argsForCall.length).toBe(2);
219
+ expect(console.error.argsForCall.length).toBe(1);
220
expect(console.error.argsForCall[0][0]).toBe(
221
'Warning: Failed Context Types: ' +
222
'Required child context `foo` was not specified in `Component`.'
223
);
224
- expect(console.error.argsForCall[1][0]).toBe(
225
- 'Warning: Failed Context Types: ' +
226
- 'Required child context `foo` was not specified in `Component`.'
227
- );
224
225
ReactTestUtils.renderIntoDocument(<Component testContext={{foo: 123}} />);
226
231
- expect(console.error.argsForCall.length).toBe(4);
232
- expect(console.error.argsForCall[3][0]).toBe(
227
+ expect(console.error.argsForCall.length).toBe(2);
228
+ expect(console.error.argsForCall[1][0]).toBe(
229
'Warning: Failed Context Types: ' +
230
'Invalid child context `foo` of type `number` ' +
231
'supplied to `Component`, expected `string`.'
@@ -244,7 +240,7 @@ describe('ReactContextValidator', function() {
240
);
241
242
// Previous calls should not log errors
247
- expect(console.error.argsForCall.length).toBe(4);
243
+ expect(console.error.argsForCall.length).toBe(2);
244
});
245
246
});
src/renderers/shared/reconciler/ReactCompositeComponent.js
-6
@@ -12,7 +12,6 @@
12
'use strict';
13
14
var ReactComponentEnvironment = require('ReactComponentEnvironment');
15
-var ReactContext = require('ReactContext');
15
var ReactCurrentOwner = require('ReactCurrentOwner');
16
var ReactElement = require('ReactElement');
17
var ReactElementValidator = require('ReactElementValidator');
@@ -756,16 +755,11 @@ var ReactCompositeComponentMixin = {
755
*/
756
_renderValidatedComponent: function() {
757
var renderedComponent;
759
- var previousContext = ReactContext.current;
760
- ReactContext.current = this._processChildContext(
761
- this._currentElement._context
762
- );
758
ReactCurrentOwner.current = this;
759
try {
760
renderedComponent =
761
this._renderValidatedComponentWithoutOwnerOrContext();
762
} finally {
768
- ReactContext.current = previousContext;
763
ReactCurrentOwner.current = null;
764
}
765
invariant(
src/renderers/shared/reconciler/ReactContext.js
deleted
-32
@@ -1,32 +0,0 @@
1
-/**
2
- * Copyright 2013-2015, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactContext
10
- */
11
-
12
-'use strict';
13
-
14
-var emptyObject = require('emptyObject');
15
-
16
-/**
17
- * Keeps track of the current context.
18
- *
19
- * The context is automatically passed down the component ownership hierarchy
20
- * and is accessible via `this.context` on ReactCompositeComponents.
21
- */
22
-var ReactContext = {
23
-
24
- /**
25
- * @internal
26
- * @type {object}
27
- */
28
- current: emptyObject
29
-
30
-};
31
-
32
-module.exports = ReactContext;