-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Can we make the ERR_SVELTE_HYDRATION_MISMATCH error more user friendly? #10630
Comments
We could possible add an attribute to the |
For this specific case, rather than failing on the client, we should probably already fail on the server. At dev time we can record which elements we're currently in and error if we discover that there's an invalid combination. For the more general case of a mismatch it could help to at dev time somehow enhance our |
#10658 made the error clearer by showing an explicit error for the case of invalid nested HTML tags. Let's see if we also find a way to make the error more helpful in other situations. |
@trueadm shouldn't |
This has since been improved. Please let us know if you find any issues. |
@trueadm It's a little bit better... I now get:
however, the Would it be possible to provide the file/line number for each of the mentioned tags? |
@thebjorn sounds like a great idea. I’ll add that information to that error on Monday :) |
Error message now includes path to the component and line/column info |
Describe the problem
I was getting this error
on a page that I eventually reduced to (it was example code from Auth.js):
and
LogOut.svelte
was simplyIn addition it only happened when the user was logged in (i.e. data.session) had a value.
It took me quite some time to figure out that it was the
<p>
and<h1>
tags that were clashing - changing p to div, or h1 to strong solves the issue.Quite obvious when you "get" it, but there wasn't any help from "the system" in figuring it out...
Describe the proposed solution
Would it be possible to include "what was rendered on the server", what "the initial UI" was, and/or where they didn't match?
Importance
would make my life easier
The text was updated successfully, but these errors were encountered: