-
Notifications
You must be signed in to change notification settings - Fork 46.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't mute hydration errors forcing client render #24276
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,9 +248,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Expected server HTML to contain a matching <span> in <span>', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You still have these though. Isn't it better to have the context here for the ones we check in prod anyway? Is it worth having both? Is it confusing that there are two with subtly different timing? Maybe it would make more sense to have the DEV only error if it was part of a larger diff across multiple mismatches which also included attributes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In other words, should we just move the insert/deletion error messages to the onRecoverableError? Perhaps batching them up if there are multiple. Oops, now you just got nerd sniped into making a larger diff view. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have another PR in the works for the diff. It's not coalesced though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But in either case I think we should fix up the inconsistency first. I.e. your concerns don't seem related to this PR per se, it just aligns the behavior for suppressHydration ones with the rest. |
||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
@@ -336,9 +337,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Did not expect server HTML to contain the text node "Server" in <span>', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
@@ -389,9 +391,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Expected server HTML to contain a matching text node for "Client" in <span>.', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
@@ -445,9 +448,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Did not expect server HTML to contain the text node "Server" in <span>.', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
@@ -500,9 +504,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Expected server HTML to contain a matching text node for "Client" in <span>.', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
@@ -630,9 +635,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Expected server HTML to contain a matching <p> in <div>.', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
@@ -681,9 +687,10 @@ describe('ReactDOMFizzServerHydrationWarning', () => { | |
]); | ||
}).toErrorDev( | ||
[ | ||
'Did not expect server HTML to contain a <p> in <div>.', | ||
'An error occurred during hydration. The server HTML was replaced with client content in <div>.', | ||
], | ||
{withoutStack: true}, | ||
{withoutStack: 1}, | ||
); | ||
} else { | ||
// This used to not warn. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These were being covered up, making mismatches with prod behavior hard to debug and fix.