-
-
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't disable hydration warning #15061
Comments
|
@dummdidumm - Shouldn't the docs make this clear that this cannot be disabled?! According to the docs, you can disable all types of warnings. There is a clear use case for this. If you get the dark mode from the local storage, the html needs to get updated without a flicker. If you update the dom inside This is how many UI libraries do this, including svelte-shadcn. You can already do this, there just needs to be a way to silence the warning, as again, the docs say you can do. This isn't about whether or not you should do this, this is about disabling the warnings, which you SHOULD be able to do. J |
@dummdidumm - Do you want me to create a new issue as J |
Put a comma between the two warning codes and it will tell you that the hydration_mismatch one cannot be disabled. That html hydration warning is correct and it can also be disabled. And again, the problem is not that it's in the head, the problem is that you are putting an invalid html tag into the head. A div cannot exist inside a head. |
Got it fixed. Thanks. |
Describe the bug
I cannot seem to disable the hydration warning.
I have tried:
<!-- svelte-ignore hydration_html_changed hydration_mismatch -->
before the problematic line.
Also the compile option:
And no avail.
This says I should be able to use
svelte-ignore
.https://svelte.dev/docs/svelte/runtime-warnings#Client-warnings-hydration_html_changed
Reproduction
My basic repo example uses the
hydration_mismatch
error, but it also seems to be a problem withhydration_html_changed
.https://github.com/jdgamble555/svelte-hydration-error/blob/master/src/routes/%2Blayout.svelte
I can't post a REPL since it doesn't support TS nor SvelteKit. However, here is SvelteLab:
https://github.com/jdgamble555/svelte-hydration-error
https://www.sveltelab.dev/xk6xs8394ns4ox5?files=.%2Fsrc%2Froutes%2F%2Blayout.svelte
You can't really see anything until you inspect the console.
Related to:
svecosystem/mode-watcher#99
svecosystem/mode-watcher#95
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: