Merge pull request #2508 from jsfb/monitor-with-context

Start monitoring uses of withContext, related to issue #2112
This commit is contained in:
Jim
2014-11-17 17:23:39 -08:00
+3
View File
@@ -13,6 +13,7 @@
var assign = require('Object.assign');
var emptyObject = require('emptyObject');
var monitorCodeUse = require('monitorCodeUse');
/**
* Keeps track of the current context.
@@ -45,6 +46,8 @@ var ReactContext = {
* @return {ReactComponent|array<ReactComponent>}
*/
withContext: function(newContext, scopedCallback) {
monitorCodeUse('react_with_context', {newContext: newContext});
var result;
var previousContext = ReactContext.current;
ReactContext.current = assign({}, previousContext, newContext);