Skip to content

Commit 9672f26

Browse files
committed
replace-fork
1 parent 9533ca2 commit 9672f26

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,9 @@ describe('ReactDOMFizzServer', () => {
468468
onError(x) {
469469
loggedErrors.push(x);
470470
},
471+
getErrorHash() {
472+
return 'Hash';
473+
},
471474
},
472475
);
473476
pipe(writable);
@@ -494,14 +497,16 @@ describe('ReactDOMFizzServer', () => {
494497

495498
// Now we can client render it instead.
496499
expect(Scheduler).toFlushAndYield([]);
497-
if (__DEV__) {
498-
expectErrors(errors, [
500+
expectErrors(
501+
errors,
502+
[
499503
{
500504
error: theError.message,
501505
componentStack: componentStack(['Lazy', 'Suspense', 'div', 'App']),
502506
},
503-
]);
504-
}
507+
],
508+
['Hash'],
509+
);
505510

506511
// The client rendered HTML is now in place.
507512
expect(getVisibleChildren(container)).toEqual(<div>Hello</div>);

packages/react-reconciler/src/ReactFiberBeginWork.old.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ import {
152152
shouldSetTextContent,
153153
isSuspenseInstancePending,
154154
isSuspenseInstanceFallback,
155+
getSuspenseInstanceFallbackError,
155156
registerSuspenseInstanceRetry,
156157
supportsHydration,
157158
isPrimaryRenderer,
@@ -2689,18 +2690,22 @@ function updateDehydratedSuspenseComponent(
26892690
// This boundary is in a permanent fallback state. In this case, we'll never
26902691
// get an update and we'll never be able to hydrate the final content. Let's just try the
26912692
// client side render instead.
2693+
const errorMsg = getSuspenseInstanceFallbackError(suspenseInstance);
26922694
return retrySuspenseComponentWithoutHydrating(
26932695
current,
26942696
workInProgress,
26952697
renderLanes,
26962698
// TODO: The server should serialize the error message so we can log it
26972699
// here on the client. Or, in production, a hash/id that corresponds to
26982700
// the error.
2699-
new Error(
2700-
'The server could not finish this Suspense boundary, likely ' +
2701-
'due to an error during server rendering. Switched to ' +
2702-
'client rendering.',
2703-
),
2701+
errorMsg
2702+
? // eslint-disable-next-line react-internal/prod-error-codes
2703+
new Error(errorMsg)
2704+
: new Error(
2705+
'The server could not finish this Suspense boundary, likely ' +
2706+
'due to an error during server rendering. Switched to ' +
2707+
'client rendering.',
2708+
),
27042709
);
27052710
}
27062711

0 commit comments

Comments
 (0)