Skip to content

Commit

Permalink
Fix misapplying prod error opt-out (#24688)
Browse files Browse the repository at this point in the history
The eslint-disable-next-line opt out for prod error minification was not properly working. In the build a replacable error was output even though it was not failing the build. This change refactors the code to avoid the erroneous behavior but a fix for the lint may be better
  • Loading branch information
gnoff authored Jun 8, 2022
1 parent 4794414 commit 060505e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
19 changes: 11 additions & 8 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2593,14 +2593,17 @@ function updateDehydratedSuspenseComponent(
({digest} = getSuspenseInstanceFallbackErrorDetails(suspenseInstance));
}

const error = message
? // eslint-disable-next-line react-internal/prod-error-codes
new Error(message)
: new Error(
'The server could not finish this Suspense boundary, likely ' +
'due to an error during server rendering. Switched to ' +
'client rendering.',
);
let error;
if (message) {
// eslint-disable-next-line react-internal/prod-error-codes
error = new Error(message);
} else {
error = new Error(
'The server could not finish this Suspense boundary, likely ' +
'due to an error during server rendering. Switched to ' +
'client rendering.',
);
}
const capturedValue = createCapturedValue(error, digest, stack);
return retrySuspenseComponentWithoutHydrating(
current,
Expand Down
19 changes: 11 additions & 8 deletions packages/react-reconciler/src/ReactFiberBeginWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -2593,14 +2593,17 @@ function updateDehydratedSuspenseComponent(
({digest} = getSuspenseInstanceFallbackErrorDetails(suspenseInstance));
}

const error = message
? // eslint-disable-next-line react-internal/prod-error-codes
new Error(message)
: new Error(
'The server could not finish this Suspense boundary, likely ' +
'due to an error during server rendering. Switched to ' +
'client rendering.',
);
let error;
if (message) {
// eslint-disable-next-line react-internal/prod-error-codes
error = new Error(message);
} else {
error = new Error(
'The server could not finish this Suspense boundary, likely ' +
'due to an error during server rendering. Switched to ' +
'client rendering.',
);
}
const capturedValue = createCapturedValue(error, digest, stack);
return retrySuspenseComponentWithoutHydrating(
current,
Expand Down

0 comments on commit 060505e

Please sign in to comment.