mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[forget-runtime] Remove invariant dep
Reduces a dep needed to be installed by users of the polyfill
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
"use no forget";
|
||||
|
||||
import invariant from "invariant";
|
||||
import * as React from "react";
|
||||
|
||||
const {
|
||||
@@ -160,10 +159,11 @@ export function $dispatcherGuard(kind: GuardKind) {
|
||||
// Pop before checking invariant or errors
|
||||
const lastFrame = guardFrames.pop();
|
||||
|
||||
invariant(
|
||||
lastFrame != null,
|
||||
"React Forget internal error: unexpected null in guard stack"
|
||||
);
|
||||
if (lastFrame == null) {
|
||||
throw new Error(
|
||||
"React Forget internal error: unexpected null in guard stack"
|
||||
);
|
||||
}
|
||||
if (guardFrames.length === 0) {
|
||||
originalDispatcher = null;
|
||||
}
|
||||
@@ -175,13 +175,14 @@ export function $dispatcherGuard(kind: GuardKind) {
|
||||
setCurrent(originalDispatcher);
|
||||
} else if (kind === GuardKind.PopExpectHook) {
|
||||
const lastFrame = guardFrames.pop();
|
||||
invariant(
|
||||
lastFrame != null,
|
||||
"React Forget internal error: unexpected null in guard stack"
|
||||
);
|
||||
if (lastFrame == null) {
|
||||
throw new Error(
|
||||
"React Forget internal error: unexpected null in guard stack"
|
||||
);
|
||||
}
|
||||
setCurrent(lastFrame);
|
||||
} else {
|
||||
invariant(false, "Forget internal error: unreachable block" + kind);
|
||||
throw new Error("Forget internal error: unreachable block" + kind);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user