pull/11690/head
Rich Harris 2 years ago
parent ced38b509e
commit 9adc60e42b

@ -10,12 +10,12 @@ import {
} from '../../../../constants.js';
import {
hydrate_anchor,
hydrate_end,
hydrate_start,
hydrating,
remove_hydrate_nodes,
set_hydrating
} from '../hydration.js';
import { clear_text_content, empty, remove_nodes } from '../operations.js';
import { clear_text_content, empty } from '../operations.js';
import { untrack } from '../../runtime.js';
import {
block,
@ -144,7 +144,7 @@ export function each(anchor, flags, get_collection, get_key, render_fn, fallback
if (is_else !== (length === 0)) {
// hydration mismatch — remove the server-rendered DOM and start over
remove_nodes(hydrate_start, hydrate_end);
remove_hydrate_nodes();
set_hydrating(false);
mismatch = true;
}

@ -1,8 +1,7 @@
import { EFFECT_TRANSPARENT } from '../../constants.js';
import { hydrate_end, hydrate_start, hydrating, set_hydrating } from '../hydration.js';
import { hydrating, remove_hydrate_nodes, set_hydrating } from '../hydration.js';
import { block, branch, pause_effect, resume_effect } from '../../reactivity/effects.js';
import { HYDRATION_END_ELSE } from '../../../../constants.js';
import { remove_nodes } from '../operations.js';
/**
* @param {Comment} anchor
@ -42,7 +41,7 @@ export function if_block(
if (condition === is_else) {
// Hydration mismatch: remove everything inside the anchor and start fresh.
// This could happen with `{#if browser}...{/if}`, for example
remove_nodes(hydrate_start, hydrate_end);
remove_hydrate_nodes();
set_hydrating(false);
mismatch = true;
}

@ -1,6 +1,7 @@
import { DEV } from 'esm-env';
import { HYDRATION_END, HYDRATION_START, HYDRATION_ERROR } from '../../../constants.js';
import * as w from '../warnings.js';
import { remove_nodes } from './operations.js';
/**
* Use this variable to guard everything related to hydration code so it can be treeshaken out
@ -84,3 +85,7 @@ export function hydrate_anchor(node) {
w.hydration_mismatch(location);
throw HYDRATION_ERROR;
}
export function remove_hydrate_nodes() {
remove_nodes(hydrate_start, hydrate_end);
}

Loading…
Cancel
Save