Skip to content

Can't disable hydration warning #15061

@jdgamble555

Description

@jdgamble555

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:

compilerOptions: {
	warningFilter: (warning) => warning.code !== 'hydration_mismatch'
}

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 with hydration_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

+layout.svelte:6 [svelte] hydration_mismatchHydration failed because the initial UI does not match what was rendered on the serverhttps://svelte.dev/e/hydration_mismatch

System Info

New SvelteKit Project.

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions