Skip to content

Commit 6025193

Browse files
committed
partial fix
1 parent 012cdeb commit 6025193

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ export function boundary(node, props, children) {
9393
var hydrate_open = hydrate_node;
9494
var is_creating_fallback = false;
9595

96-
/** @type {Array<() => void>} */
97-
var callbacks = [];
96+
/** @type {Set<() => void>} */
97+
var callbacks = new Set();
9898

9999
/** @type {Effect[]} */
100100
var render_effects = [];
@@ -155,8 +155,8 @@ export function boundary(node, props, children) {
155155
}
156156
}
157157

158-
run_all(callbacks);
159-
callbacks.length = 0;
158+
for (const fn of callbacks) fn();
159+
callbacks.clear();
160160

161161
if (pending_effect) {
162162
pause_effect(pending_effect, () => {
@@ -205,7 +205,7 @@ export function boundary(node, props, children) {
205205
}
206206

207207
if (input === ADD_CALLBACK) {
208-
callbacks.push(payload);
208+
callbacks.add(payload);
209209
return;
210210
}
211211

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

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,17 @@ function reconcile(
401401
for (i = 0; i < length; i += 1) {
402402
value = array[i];
403403
key = get_key(value, i);
404-
item = items.get(key) ?? pending_items.get(key);
404+
405+
item = items.get(key);
406+
407+
if (item === undefined) {
408+
var pending = pending_items.get(key);
409+
if (pending !== undefined) {
410+
pending_items.delete(key);
411+
items.set(key, pending);
412+
item = pending;
413+
}
414+
}
405415

406416
if (item === undefined) {
407417
var child_anchor = current ? /** @type {TemplateNode} */ (current.e.nodes_start) : anchor;
@@ -550,12 +560,17 @@ function reconcile(
550560
}
551561

552562
// TODO this seems super weird... should be `each_effect`, but that doesn't seem to work?
553-
if (active_effect !== null) {
554-
active_effect.first = state.first && state.first.e;
555-
active_effect.last = prev && prev.e;
556-
}
563+
// if (active_effect !== null) {
564+
// active_effect.first = state.first && state.first.e;
565+
// active_effect.last = prev && prev.e;
566+
// }
557567

558-
pending_items.clear();
568+
each_effect.first = state.first && state.first.e;
569+
each_effect.last = prev && prev.e;
570+
571+
for (var unused of pending_items.values()) {
572+
destroy_effect(unused.e);
573+
}
559574
}
560575

561576
/**

0 commit comments

Comments
 (0)