Skip to content

Commit 58dad20

Browse files
committed
fix
1 parent 500490c commit 58dad20

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

packages/svelte/src/internal/client/dom/hydration.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,7 @@ function get_hydrate_nodes(node, insert_text = false) {
4848
/** @type {import('#client').TemplateNode[]} */
4949
var nodes = [];
5050

51-
/** @type {null | Node} */
52-
var current_node = node;
51+
var current_node = /** @type {null | import('#client').TemplateNode} */ (node);
5352

5453
/** @type {null | string} */
5554
var target_depth = null;
@@ -67,18 +66,18 @@ function get_hydrate_nodes(node, insert_text = false) {
6766
if (insert_text && nodes.length === 0) {
6867
var text = empty();
6968
nodes.push(text);
70-
text.before(current_node);
69+
current_node.before(text);
7170
}
7271
return nodes;
7372
} else {
74-
nodes.push(/** @type {Text | Comment | Element} */ (current_node));
73+
nodes.push(current_node);
7574
}
7675
}
7776
} else if (target_depth !== null) {
78-
nodes.push(/** @type {Text | Comment | Element} */ (current_node));
77+
nodes.push(current_node);
7978
}
8079

81-
current_node = current_node.nextSibling;
80+
current_node = /** @type {null | import('#client').TemplateNode} */ (current_node.nextSibling);
8281
}
8382

8483
return null;

packages/svelte/src/internal/client/render.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ export function createRoot() {
114114
* @returns {Exports}
115115
*/
116116
export function mount(component, options) {
117-
init_operations();
118117
const anchor = empty();
119118
options.target.appendChild(anchor);
120119
// Don't flush previous effects to ensure order of outer effects stays consistent
@@ -139,8 +138,6 @@ export function mount(component, options) {
139138
* @returns {Exports}
140139
*/
141140
export function hydrate(component, options) {
142-
init_operations();
143-
144141
const container = options.target;
145142
const first_child = /** @type {ChildNode} */ (container.firstChild);
146143
const previous_hydrate_nodes = hydrate_nodes;
@@ -212,6 +209,8 @@ export function hydrate(component, options) {
212209
* @returns {Exports}
213210
*/
214211
function _mount(Component, options) {
212+
init_operations();
213+
215214
const registered_events = new Set();
216215
const container = options.target;
217216

0 commit comments

Comments
 (0)