|
|
@ -81,7 +81,8 @@ export function set_text(text, value) {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
export function mount(component, options) {
|
|
|
|
export function mount(component, options) {
|
|
|
|
const anchor = options.anchor ?? options.target.appendChild(empty());
|
|
|
|
const anchor = options.anchor ?? options.target.appendChild(empty());
|
|
|
|
return _mount(component, { ...options, anchor });
|
|
|
|
// Don't flush previous effects to ensure order of outer effects stays consistent
|
|
|
|
|
|
|
|
return flush_sync(() => _mount(component, { ...options, anchor }), false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -114,35 +115,38 @@ export function hydrate(component, options) {
|
|
|
|
const previous_hydrate_node = hydrate_node;
|
|
|
|
const previous_hydrate_node = hydrate_node;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
var anchor = /** @type {TemplateNode} */ (target.firstChild);
|
|
|
|
// Don't flush previous effects to ensure order of outer effects stays consistent
|
|
|
|
while (
|
|
|
|
return flush_sync(() => {
|
|
|
|
anchor &&
|
|
|
|
var anchor = /** @type {TemplateNode} */ (target.firstChild);
|
|
|
|
(anchor.nodeType !== 8 || /** @type {Comment} */ (anchor).data !== HYDRATION_START)
|
|
|
|
while (
|
|
|
|
) {
|
|
|
|
anchor &&
|
|
|
|
anchor = /** @type {TemplateNode} */ (anchor.nextSibling);
|
|
|
|
(anchor.nodeType !== 8 || /** @type {Comment} */ (anchor).data !== HYDRATION_START)
|
|
|
|
}
|
|
|
|
) {
|
|
|
|
|
|
|
|
anchor = /** @type {TemplateNode} */ (anchor.nextSibling);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!anchor) {
|
|
|
|
if (!anchor) {
|
|
|
|
throw HYDRATION_ERROR;
|
|
|
|
throw HYDRATION_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set_hydrating(true);
|
|
|
|
set_hydrating(true);
|
|
|
|
set_hydrate_node(/** @type {Comment} */ (anchor));
|
|
|
|
set_hydrate_node(/** @type {Comment} */ (anchor));
|
|
|
|
hydrate_next();
|
|
|
|
hydrate_next();
|
|
|
|
|
|
|
|
|
|
|
|
const instance = _mount(component, { ...options, anchor });
|
|
|
|
const instance = _mount(component, { ...options, anchor });
|
|
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
if (
|
|
|
|
hydrate_node.nodeType !== 8 ||
|
|
|
|
hydrate_node.nodeType !== 8 ||
|
|
|
|
/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END
|
|
|
|
/** @type {Comment} */ (hydrate_node).data !== HYDRATION_END
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
w.hydration_mismatch();
|
|
|
|
w.hydration_mismatch();
|
|
|
|
throw HYDRATION_ERROR;
|
|
|
|
throw HYDRATION_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set_hydrating(false);
|
|
|
|
set_hydrating(false);
|
|
|
|
|
|
|
|
|
|
|
|
return /** @type {Exports} */ (instance);
|
|
|
|
return instance;
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
} catch (error) {
|
|
|
|
} catch (error) {
|
|
|
|
if (error === HYDRATION_ERROR) {
|
|
|
|
if (error === HYDRATION_ERROR) {
|
|
|
|
// TODO it's possible for event listeners to have been added and
|
|
|
|
// TODO it's possible for event listeners to have been added and
|
|
|
|