fix: add missing hydration mismatch call-site (#12604)

* fix: add missing hydration mismatch call-site

* add changeset

* Update playgrounds/demo/index.html

Co-authored-by: Conduitry <git@chor.date>

---------

Co-authored-by: Conduitry <git@chor.date>
pull/12605/head
Dominic Gannaway 4 months ago committed by GitHub
parent 3515776009
commit 5a07219836
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: add missing hydration mismatch call-site

@ -1,6 +1,12 @@
/** @import { TemplateNode } from '#client' */ /** @import { TemplateNode } from '#client' */
import { HYDRATION_END, HYDRATION_START, HYDRATION_START_ELSE } from '../../../constants.js'; import {
HYDRATION_END,
HYDRATION_ERROR,
HYDRATION_START,
HYDRATION_START_ELSE
} from '../../../constants.js';
import * as w from '../warnings.js';
/** /**
* Use this variable to guard everything related to hydration code so it can be treeshaken out * Use this variable to guard everything related to hydration code so it can be treeshaken out
@ -28,6 +34,10 @@ export function set_hydrate_node(node) {
} }
export function hydrate_next() { export function hydrate_next() {
if (hydrate_node === null) {
w.hydration_mismatch();
throw HYDRATION_ERROR;
}
return (hydrate_node = /** @type {TemplateNode} */ (hydrate_node.nextSibling)); return (hydrate_node = /** @type {TemplateNode} */ (hydrate_node.nextSibling));
} }

Loading…
Cancel
Save