Skip to content
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

Print server nodes for hydration mismatch #24159

Closed
wants to merge 1 commit into from
Closed

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Mar 25, 2022

Similar in spirit to #22786.

Haven't tested if it works yet.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Mar 25, 2022
@@ -156,9 +169,15 @@ if (__DEV__) {
JSON.stringify(normalizedServerValue),
JSON.stringify(normalizedClientValue),
);
if (!isJsdomDev) {
console['error']('Server HTML:', domElement);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untransformed because we don't want Warning: prefix or component stack.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess DevTools adds component stack anyway.

@@ -156,9 +169,15 @@ if (__DEV__) {
JSON.stringify(normalizedServerValue),
JSON.stringify(normalizedClientValue),
);
if (!isJsdomDev) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're pretty noisy in Node environment because it starts printing fibers due to the reference inside. Plus not very helpful anyway. Not sure if there's a better way to detect.

@sizebot
Copy link

sizebot commented Mar 25, 2022

Comparing: 4072bdf...0f4f924

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 131.32 kB 131.32 kB = 41.96 kB 41.96 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 136.38 kB 136.38 kB = 43.42 kB 43.42 kB
facebook-www/ReactDOM-prod.classic.js = 432.73 kB 432.73 kB = 79.60 kB 79.60 kB
facebook-www/ReactDOM-prod.modern.js = 417.73 kB 417.73 kB = 77.22 kB 77.21 kB
facebook-www/ReactDOMForked-prod.classic.js = 432.73 kB 432.73 kB = 79.60 kB 79.60 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 0f4f924

@gaearon
Copy link
Collaborator Author

gaearon commented Mar 25, 2022

So this works, but I think the messages need some tweaking so that the context is clearer. Especially for the "expected A, found B" kind of thing where the current message feels misleading/missing info even with the parent node. It needs the child node as well.

@gaearon gaearon closed this Apr 1, 2022
@gaearon
Copy link
Collaborator Author

gaearon commented Apr 1, 2022

#24250

@gaearon gaearon deleted the hydration-print-node branch April 1, 2022 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants