@samitouri / QOS-React / commits / 7d31311de3

Don't pass a Fiber to showErrorDialog() (#12445)

* Don't pass a Fiber to showErrorDialog() * Only fill in the fields for classes * Reorder for clarity

Dan Abramov committed Mar 23, 2018 at 21:52 UTC 7d31311de3e1b3f698dd0fb7a28c40eafe8cca64
1 file changed +6 -8
packages/react-reconciler/src/ReactFiberCommitWork.js
+6 -8
@@ -53,21 +53,19 @@ function logError(boundary: Fiber, errorInfo: CapturedValue<mixed>) {
53
54 const capturedError: CapturedError = {
55 componentName: source !== null ? getComponentName(source) : null,
56 - error: errorInfo.value,
57 - errorBoundary: boundary,
56 componentStack: stack !== null ? stack : '',
57 + error: errorInfo.value,
58 + errorBoundary: null,
59 errorBoundaryName: null,
60 errorBoundaryFound: false,
61 willRetry: false,
62 };
63
64 - if (boundary !== null) {
64 + if (boundary !== null && boundary.tag === ClassComponent) {
65 + capturedError.errorBoundary = boundary.stateNode;
66 capturedError.errorBoundaryName = getComponentName(boundary);
66 - capturedError.errorBoundaryFound = capturedError.willRetry =
67 - boundary.tag === ClassComponent;
68 - } else {
69 - capturedError.errorBoundaryName = null;
70 - capturedError.errorBoundaryFound = capturedError.willRetry = false;
67 + capturedError.errorBoundaryFound = true;
68 + capturedError.willRetry = true;
69 }
70
71 try {