-
Notifications
You must be signed in to change notification settings - Fork 27k
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
re-add hydration support to React 18 errors #69757
re-add hydration support to React 18 errors #69757
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
f20e3c5
to
e7a914c
Compare
'Warning: Text content did not match. Server: "%s" Client: "%s"%s' | ||
|
||
const isTextMismatchWarning = (msg: NullableText) => textMismatchWarning === msg | ||
const isTextInTagsMismatchWarning = (msg: NullableText) => |
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.
...args, | ||
// We tack on the hydration error message to the console.error message so that | ||
// it matches the error we display in the redbox overlay | ||
`\nSee more info here: https://nextjs.org/docs/messages/react-hydration-error`, |
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.
Supports behavior that was lost from:
@@ -38,7 +37,7 @@ describe.skip('Error overlay for hydration errors (React 18)', () => { | |||
await session.assertHasRedbox() | |||
|
|||
expect(await session.getRedboxDescription()).toMatchInlineSnapshot(` | |||
"Error: Text content does not match server-rendered HTML. | |||
"Text content does not match server-rendered HTML. |
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.
Slight change in behavior but showing Error:
in an error overlay feels a bit redundant
e7a914c
to
81ceea6
Compare
@@ -307,7 +307,9 @@ export function Errors({ | |||
{/* If there's hydration warning, skip displaying the error name */} | |||
{hydrationWarning ? '' : error.name + ': '} | |||
<HotlinkedText | |||
text={hydrationWarning || error.message} | |||
text={ | |||
isAppDir ? hydrationWarning || error.message : error.message |
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.
Reverts the Errors.tsx
changes from:
to match the React 18 behavior when not in app dir
Failing test suitesCommit: f7a2265
Expand output● Production Usage › should output traces
Read more about building and testing Next.js in contributing.md.
Expand output● minified module ids › production mode › should have no long module ids for basic modules
● minified module ids › production mode › should have no long module ids for external modules
● minified module ids › production mode › should have no long module ids for async loader modules
● minified module ids › production mode › should have no long module id for the next client runtime module
Read more about building and testing Next.js in contributing.md.
Expand output● getServerSideProps › should dedupe server data requests
Read more about building and testing Next.js in contributing.md. |
81ceea6
to
546d978
Compare
546d978
to
39fa29b
Compare
39fa29b
to
4360de1
Compare
@@ -4,7 +4,8 @@ import { FileRef, nextTestSetup } from 'e2e-utils' | |||
import { outdent } from 'outdent' | |||
import path from 'path' | |||
|
|||
describe('Error overlay for hydration errors (React 19)', () => { | |||
// TODO: Enable once React 19 support is added to pages. | |||
describe.skip('Error overlay for hydration errors (React 19)', () => { |
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.
This can't run because we throw in pages if 18 is used
4360de1
to
f7a2265
Compare
1de62ed
into
sebbie/08-30-react-sync_cleanup_inaccurate_peer_dependencies
Re-lands hydration support for React 18 errors by reverting some things that were part of #65058. Annotated specific parts with comments.
Re-lands hydration support for React 18 errors by reverting some things that were part of #65058. Annotated specific parts with comments.
Re-lands hydration support for React 18 errors by reverting some things that were part of #65058. Annotated specific parts with comments.