diff --git a/src/renderers/shared/fiber/ReactFiberContext.js b/src/renderers/shared/fiber/ReactFiberContext.js index 33766583a5b7a..70e53de431f8c 100644 --- a/src/renderers/shared/fiber/ReactFiberContext.js +++ b/src/renderers/shared/fiber/ReactFiberContext.js @@ -37,7 +37,7 @@ if (__DEV__) { } let contextStackCursor : StackCursor = createCursor((null: ?Object)); -let didPerformWorkStackCursor : StackCursor = createCursor((null: ?boolean)); +let didPerformWorkStackCursor : StackCursor = createCursor(false); function getUnmaskedContext() { return contextStackCursor.current || emptyObject; @@ -66,7 +66,7 @@ exports.getMaskedContext = function(workInProgress : Fiber) { }; exports.hasContextChanged = function() : boolean { - return Boolean(didPerformWorkStackCursor.current); + return didPerformWorkStackCursor.current; }; function isContextProvider(fiber : Fiber) : boolean { @@ -136,8 +136,10 @@ exports.pushContextProvider = function(workInProgress : Fiber, didPerformWork : }; exports.resetContext = function() : void { - reset(contextStackCursor); - reset(didPerformWorkStackCursor); + reset(); + + contextStackCursor.current = null; + didPerformWorkStackCursor.current = false; }; exports.findCurrentUnmaskedContext = function(fiber: Fiber) : Object { diff --git a/src/renderers/shared/fiber/ReactFiberHostContext.js b/src/renderers/shared/fiber/ReactFiberHostContext.js index a10688aa7f89e..94a0e636204d8 100644 --- a/src/renderers/shared/fiber/ReactFiberHostContext.js +++ b/src/renderers/shared/fiber/ReactFiberHostContext.js @@ -114,8 +114,10 @@ module.exports = function( } function resetHostContainer() { - reset(contextStackCursor); - reset(rootInstanceStackCursor); + reset(); + + contextStackCursor.current = null; + rootInstanceStackCursor.current = null; } return { diff --git a/src/renderers/shared/fiber/ReactFiberStack.js b/src/renderers/shared/fiber/ReactFiberStack.js index 7c41c93b685ce..3d51b4aec64c5 100644 --- a/src/renderers/shared/fiber/ReactFiberStack.js +++ b/src/renderers/shared/fiber/ReactFiberStack.js @@ -55,9 +55,7 @@ exports.pop = function( } } - cursor.current = index > 0 - ? valueStack[index] - : (null : any); + cursor.current = valueStack[index]; valueStack[index] = null; @@ -70,7 +68,7 @@ exports.pop = function( exports.push = function( cursor : StackCursor, - value : any, + value : T, fiber: Fiber, ) : void { index++; @@ -84,9 +82,7 @@ exports.push = function( cursor.current = value; }; -exports.reset = function( - cursor : StackCursor, -) : void { +exports.reset = function() : void { while (index > -1) { valueStack[index] = null; @@ -96,6 +92,4 @@ exports.reset = function( index--; } - - cursor.current = (null : any); };