Skip to content

Remove errorHydratingContainer #28664

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 18 additions & 39 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2406,19 +2406,12 @@ describe('ReactDOMFizzServer', () => {
},
});

await expect(async () => {
// The first paint switches to client rendering due to mismatch
await waitForPaint([
'client',
"Log recoverable error: Hydration failed because the server rendered HTML didn't match the client.",
'Log recoverable error: There was an error while hydrating.',
]);
}).toErrorDev(
[
'Warning: An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
// The first paint switches to client rendering due to mismatch
await waitForPaint([
'client',
"Log recoverable error: Hydration failed because the server rendered HTML didn't match the client.",
'Log recoverable error: There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(<div>client</div>);
});

Expand Down Expand Up @@ -2486,19 +2479,12 @@ describe('ReactDOMFizzServer', () => {
});

// The first paint uses the client due to mismatch forcing client render
await expect(async () => {
// The first paint switches to client rendering due to mismatch
await waitForPaint([
'client',
"Log recoverable error: Hydration failed because the server rendered HTML didn't match the client.",
'Log recoverable error: There was an error while hydrating.',
]);
}).toErrorDev(
[
'Warning: An error occurred during hydration. The server HTML was replaced with client content',
],
{withoutStack: 1},
);
// The first paint switches to client rendering due to mismatch
await waitForPaint([
'client',
"Log recoverable error: Hydration failed because the server rendered HTML didn't match the client.",
'Log recoverable error: There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(<div>client</div>);
});

Expand Down Expand Up @@ -2564,16 +2550,11 @@ describe('ReactDOMFizzServer', () => {

// An error logged but instead of surfacing it to the UI, we switched
// to client rendering.
await expect(async () => {
await waitForAll([
'Yay!',
'Hydration error',
'There was an error while hydrating.',
]);
}).toErrorDev(
'An error occurred during hydration. The server HTML was replaced',
{withoutStack: true},
);
await waitForAll([
'Yay!',
'Hydration error',
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(<span>Yay!</span>);

// The node that's inside the boundary that errored during hydration was
Expand Down Expand Up @@ -6339,9 +6320,7 @@ describe('ReactDOMFizzServer', () => {
errors.push(error);
},
});
await expect(async () => {
await waitForAll([]);
}).toErrorDev(['An error occurred during hydration'], {withoutStack: 1});
await waitForAll([]);
expect(errors.length).toEqual(2);
expect(getVisibleChildren(container)).toEqual(<span />);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,17 +249,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<span>
Expand Down Expand Up @@ -337,17 +330,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<span />
Expand Down Expand Up @@ -384,17 +370,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<span>
Expand Down Expand Up @@ -434,17 +413,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<span>
Expand Down Expand Up @@ -482,17 +454,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<span>
Expand Down Expand Up @@ -604,17 +569,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<p>Client and server</p>
Expand Down Expand Up @@ -649,17 +607,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
Scheduler.log(normalizeError(error.message));
},
});
await expect(async () => {
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
}).toErrorDev(
[
'An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([
"Hydration failed because the server rendered HTML didn't match the client.",
'There was an error while hydrating.',
]);
expect(getVisibleChildren(container)).toEqual(
<div>
<p>Client and server</p>
Expand Down
18 changes: 2 additions & 16 deletions packages/react-dom/src/__tests__/ReactDOMFloat-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6477,14 +6477,7 @@ body {
},
},
);
await expect(async () => {
await waitForAll([]);
}).toErrorDev(
[
'Warning: An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
<html>
<head>
Expand Down Expand Up @@ -8267,14 +8260,7 @@ background-color: green;
},
);

await expect(async () => {
await waitForAll([]);
}).toErrorDev(
[
'Warning: An error occurred during hydration. The server HTML was replaced with client content.',
],
{withoutStack: 1},
);
await waitForAll([]);
expect(getMeaningfulChildren(document)).toEqual(
<html>
<head>
Expand Down
Loading