HostRoot no longer pops context provider in complete phase Also added an invariant warning to guard against context being popped too many times.
HostRoot no longer pops context provider in complete phase Also added an invariant warning to guard against context being popped too many times.
Brian Vaughn committed
Dec 13, 2016 at 17:26 UTC
b4745ca72b63f1e5c9291bd030e6d0a28c23bcb7
2 files changed
+1
-1
src/renderers/shared/fiber/ReactFiberCompleteWork.js
-1
@@ -202,7 +202,6 @@ module.exports = function<T, P, I, TI, C, CX>(
202
return null;
203
case HostRoot: {
204
workInProgress.memoizedProps = workInProgress.pendingProps;
205
- popContextProvider();
205
const fiberRoot = (workInProgress.stateNode : FiberRoot);
206
if (fiberRoot.pendingContext) {
207
fiberRoot.context = fiberRoot.pendingContext;
src/renderers/shared/fiber/ReactFiberContext.js
+1
@@ -77,6 +77,7 @@ function isContextProvider(fiber : Fiber) : boolean {
77
exports.isContextProvider = isContextProvider;
78
79
function popContextProvider() : void {
80
+ invariant(index > -1, 'Unexpected context pop');
81
contextStack[index] = emptyObject;
82
didPerformWorkStack[index] = false;
83
index--;