-
Notifications
You must be signed in to change notification settings - Fork 47k
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
[WIP] Diffs for hydration errors #24250
Conversation
gaearon
commented
Apr 1, 2022
•
edited
Loading
edited
- Errors
- Extra server element
- Extra server text
- Extra client element
- Extra client text
- Extra server attributes
- Prop mismatch
- Formatting
- Parent tag and attributes
- Sibling tag/text and attributes
- Child tag/text and attributes
- Ellipsis to indicate more siblings before or after
- Special cases
- Document/fragment parent
- Long attributes
- Too many attributes
- Quotes in attributes
- Long text
- Skip over non-element/text siblings
- Other stuff
- Flow
Comparing: 0dc4e66...35c1424 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
'Did not expect server HTML to contain a <%s> in <%s>.', | ||
child.nodeName.toLowerCase(), | ||
parentNode.nodeName.toLowerCase(), | ||
'The content rendered by the server and the client did not match ' + |
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.
The explanation in detail sounds great, but I feel there are too many words that are the same across multiple messages until the very essence of this message which is "the server has rendered an extra text node". Could be easier and quicker to grasp the gist if the varying part of the message was at the beginning, and the repetitive explanation at the end.
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.
Yeah good point. I'll take another pass to clean them up after all of them are covered.
bdea0dc
to
35c1424
Compare
This would be great, also for Next.js: |
Any update for this PR? |
No, I'm not actively working on this so there won't be any update. |
Someone motivated could pick this up though! |
I will try to continue when I'm avaliable! |
That would be great! The first step would probably be to get this rebased and/or rewrite it based on the tests I added and the logic I've included. Then you can look at the remaining TODOs. |
|
||
function formatNode(node, indentation) { | ||
switch (node.nodeType) { | ||
// TODO: use constants |
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.
What does use constants
mean here? Isn't here already constants?
Going with a more invasive refactor and different approach in #28512. |