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

[WIP] Diffs for hydration errors #27808

Closed
wants to merge 15 commits into from

Conversation

himself65
Copy link
Contributor

@himself65 himself65 commented Dec 7, 2023

Summary

continue working on Upstream PR: #24250, Thanks the work by @gaearon

Progress

  • 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

How did you test this change?

gaearon and others added 8 commits April 20, 2022 19:54
# Conflicts:
#	packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js
#	packages/react-dom/src/client/ReactDOMComponent.js
#	packages/react-dom/src/client/ReactDOMHostConfig.js
@facebook-github-bot
Copy link

Hi @himself65!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@react-sizebot
Copy link

react-sizebot commented Dec 7, 2023

Comparing: be8aa76...4102015

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 = 175.90 kB 175.90 kB = 54.75 kB 54.76 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 177.97 kB 177.97 kB = 55.39 kB 55.39 kB
facebook-www/ReactDOM-prod.classic.js = 569.81 kB 569.81 kB = 100.29 kB 100.29 kB
facebook-www/ReactDOM-prod.modern.js = 553.67 kB 553.67 kB = 97.38 kB 97.38 kB
test_utils/ReactAllWarnings.js Deleted 67.17 kB 0.00 kB Deleted 16.35 kB 0.00 kB

Significant size changes

Includes any change greater than 0.2%:

Expand to show
Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable-semver/react-dom/umd/react-dom.development.js +0.40% 1,397.31 kB 1,402.95 kB +0.33% 297.68 kB 298.66 kB
oss-stable/react-dom/umd/react-dom.development.js +0.40% 1,397.34 kB 1,402.97 kB +0.33% 297.70 kB 298.68 kB
oss-experimental/react-dom/umd/react-dom.development.js +0.40% 1,410.86 kB 1,416.49 kB +0.33% 300.14 kB 301.14 kB
oss-stable-semver/react-dom/cjs/react-dom.development.js +0.40% 1,333.25 kB 1,338.57 kB +0.33% 294.65 kB 295.61 kB
oss-stable/react-dom/cjs/react-dom.development.js +0.40% 1,333.27 kB 1,338.59 kB +0.33% 294.68 kB 295.64 kB
oss-experimental/react-dom/cjs/react-dom.development.js +0.40% 1,346.14 kB 1,351.46 kB +0.32% 297.08 kB 298.04 kB
oss-experimental/react-dom/cjs/react-dom-unstable_testing.development.js +0.39% 1,364.19 kB 1,369.51 kB +0.31% 301.44 kB 302.39 kB
facebook-www/ReactDOM-dev.modern.js +0.39% 1,585.43 kB 1,591.58 kB +0.31% 314.98 kB 315.95 kB
facebook-www/ReactDOMTesting-dev.modern.js +0.38% 1,606.43 kB 1,612.58 kB +0.31% 319.51 kB 320.50 kB
facebook-www/ReactDOM-dev.classic.js +0.38% 1,617.02 kB 1,623.17 kB +0.31% 320.75 kB 321.74 kB
facebook-www/ReactDOMTesting-dev.classic.js +0.38% 1,638.02 kB 1,644.17 kB +0.30% 325.25 kB 326.24 kB
test_utils/ReactAllWarnings.js Deleted 67.17 kB 0.00 kB Deleted 16.35 kB 0.00 kB

Generated by 🚫 dangerJS against 4102015

@ilyaGurevich
Copy link

ilyaGurevich commented Feb 5, 2024

@himself65 just wanted to follow-up here, nytimes.com has recently migrated over to React 18 and are experiencing an influx of hydration mis-match errors that we hope to squash soon, however, the current stack trace is a bit hard to parse and we hope to be able to rely on this diffing PR as a reliable way to debug, do you have a sense of when this work might be completed? It would help a lot on our end.

@himself65
Copy link
Contributor Author

@himself65 just wanted to follow-up here, nytimes.com has recently migrated over to React 18 and are experiencing an influx of hydration mis-match errors that we hope to squash soon, however, the current stack trace is a bit hard to parse and we hope to be able to rely on this diffing PR as a reliable way to debug, do you have a sense of when this work might be completed? It would help a lot on our end.

Sorry for late update on this PR. Currently im working on llamaindex and other react downstream libraries, I think I can continue on this PR during this month. Logic is simple but Mostly Im stucking on debugging flow and react source code.

Sorry for low contribution on this but Im trying

@himself65
Copy link
Contributor Author

@ilyaGurevich I will recommend using this for hydration diff for a fast fix for now.

https://github.com/BuilderIO/hydration-overlay

@sebmarkbage
Copy link
Collaborator

Thanks for picking this up! We're going with a different approach with a more invasive refactor in #28512. I'll close this one out.

@sebmarkbage sebmarkbage closed this Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants