pull/10891/head
Rich Harris 2 years ago
parent 500490cc7e
commit 58dad20f38

@ -48,8 +48,7 @@ function get_hydrate_nodes(node, insert_text = false) {
/** @type {import('#client').TemplateNode[]} */ /** @type {import('#client').TemplateNode[]} */
var nodes = []; var nodes = [];
/** @type {null | Node} */ var current_node = /** @type {null | import('#client').TemplateNode} */ (node);
var current_node = node;
/** @type {null | string} */ /** @type {null | string} */
var target_depth = null; var target_depth = null;
@ -67,18 +66,18 @@ function get_hydrate_nodes(node, insert_text = false) {
if (insert_text && nodes.length === 0) { if (insert_text && nodes.length === 0) {
var text = empty(); var text = empty();
nodes.push(text); nodes.push(text);
text.before(current_node); current_node.before(text);
} }
return nodes; return nodes;
} else { } else {
nodes.push(/** @type {Text | Comment | Element} */ (current_node)); nodes.push(current_node);
} }
} }
} else if (target_depth !== null) { } else if (target_depth !== null) {
nodes.push(/** @type {Text | Comment | Element} */ (current_node)); nodes.push(current_node);
} }
current_node = current_node.nextSibling; current_node = /** @type {null | import('#client').TemplateNode} */ (current_node.nextSibling);
} }
return null; return null;

@ -114,7 +114,6 @@ export function createRoot() {
* @returns {Exports} * @returns {Exports}
*/ */
export function mount(component, options) { export function mount(component, options) {
init_operations();
const anchor = empty(); const anchor = empty();
options.target.appendChild(anchor); options.target.appendChild(anchor);
// Don't flush previous effects to ensure order of outer effects stays consistent // Don't flush previous effects to ensure order of outer effects stays consistent
@ -139,8 +138,6 @@ export function mount(component, options) {
* @returns {Exports} * @returns {Exports}
*/ */
export function hydrate(component, options) { export function hydrate(component, options) {
init_operations();
const container = options.target; const container = options.target;
const first_child = /** @type {ChildNode} */ (container.firstChild); const first_child = /** @type {ChildNode} */ (container.firstChild);
const previous_hydrate_nodes = hydrate_nodes; const previous_hydrate_nodes = hydrate_nodes;
@ -212,6 +209,8 @@ export function hydrate(component, options) {
* @returns {Exports} * @returns {Exports}
*/ */
function _mount(Component, options) { function _mount(Component, options) {
init_operations();
const registered_events = new Set(); const registered_events = new Set();
const container = options.target; const container = options.target;

Loading…
Cancel
Save