Skip to content

Commit d4dc3f9

Browse files
committed
working
1 parent c6eb00e commit d4dc3f9

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

packages/svelte/src/internal/client/dom/blocks/each.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,12 @@ function each(anchor, flags, get_collection, get_key, render_fn, fallback_fn, re
129129
}
130130

131131
// remove excess nodes
132-
while (child_anchor !== anchor) {
133-
var next = /** @type {import('#client').TemplateNode} */ (child_anchor.nextSibling);
134-
/** @type {import('#client').TemplateNode} */ (child_anchor).remove();
135-
child_anchor = next;
132+
if (length > 0) {
133+
while (child_anchor !== anchor) {
134+
var next = /** @type {import('#client').TemplateNode} */ (child_anchor.nextSibling);
135+
/** @type {import('#client').TemplateNode} */ (child_anchor).remove();
136+
child_anchor = next;
137+
}
136138
}
137139

138140
state.items = b_items;

packages/svelte/src/internal/client/dom/blocks/svelte-element.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { namespace_svg } from '../../../../constants.js';
2-
import { hydrate_nodes, hydrating } from '../hydration.js';
2+
import { hydrate_anchor, hydrate_nodes, hydrating } from '../hydration.js';
33
import { empty } from '../operations.js';
44
import {
55
destroy_effect,
@@ -112,7 +112,7 @@ export function element(anchor, get_tag, is_svg, render_fn) {
112112
// If hydrating, use the existing ssr comment as the anchor so that the
113113
// inner open and close methods can pick up the existing nodes correctly
114114
var child_anchor = hydrating
115-
? /** @type {Comment} */ (element.firstChild)
115+
? element.firstChild && hydrate_anchor(/** @type {Comment} */ (element.firstChild))
116116
: element.appendChild(empty());
117117

118118
if (child_anchor) {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ export function hydrate(component, options) {
154154
return instance;
155155
}, false);
156156
} catch (error) {
157-
console.error(error.stack);
158-
159157
if (!hydrated && options.recover !== false) {
160158
// eslint-disable-next-line no-console
161159
console.error(

0 commit comments

Comments
 (0)