Skip to content

Commit 5a07219

Browse files
trueadmConduitry
andauthored
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 <[email protected]> --------- Co-authored-by: Conduitry <[email protected]>
1 parent 3515776 commit 5a07219

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.changeset/hip-stingrays-teach.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: add missing hydration mismatch call-site

packages/svelte/src/internal/client/dom/hydration.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
/** @import { TemplateNode } from '#client' */
22

3-
import { HYDRATION_END, HYDRATION_START, HYDRATION_START_ELSE } from '../../../constants.js';
3+
import {
4+
HYDRATION_END,
5+
HYDRATION_ERROR,
6+
HYDRATION_START,
7+
HYDRATION_START_ELSE
8+
} from '../../../constants.js';
9+
import * as w from '../warnings.js';
410

511
/**
612
* 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) {
2834
}
2935

3036
export function hydrate_next() {
37+
if (hydrate_node === null) {
38+
w.hydration_mismatch();
39+
throw HYDRATION_ERROR;
40+
}
3141
return (hydrate_node = /** @type {TemplateNode} */ (hydrate_node.nextSibling));
3242
}
3343

0 commit comments

Comments
 (0)