Skip to content

fix: add missing hydration mismatch call-site #12604

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

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading