Skip to content

Commit

Permalink
fix: add missing hydration mismatch call-site (#12604)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
trueadm and Conduitry committed Jul 25, 2024
1 parent 3515776 commit 5a07219
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/hip-stingrays-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: add missing hydration mismatch call-site
12 changes: 11 additions & 1 deletion packages/svelte/src/internal/client/dom/hydration.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/** @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
Expand Down Expand Up @@ -28,6 +34,10 @@ export function set_hydrate_node(node) {
}

export function hydrate_next() {
if (hydrate_node === null) {
w.hydration_mismatch();
throw HYDRATION_ERROR;
}
return (hydrate_node = /** @type {TemplateNode} */ (hydrate_node.nextSibling));
}

Expand Down

0 comments on commit 5a07219

Please sign in to comment.