Skip to content

Commit ff48b23

Browse files
committed
all tests passing
1 parent 5b17fdd commit ff48b23

File tree

1 file changed

+18
-0
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export class BranchManager {
4040

4141
#commit = () => {
4242
var batch = /** @type {Batch} */ (current_batch);
43+
44+
// if this batch was made obsolete, bail
45+
if (!this.#batches.has(batch)) return;
46+
4347
var key = /** @type {Key} */ (this.#batches.get(batch));
4448

4549
var onscreen = this.#onscreen.get(key);
@@ -64,6 +68,20 @@ export class BranchManager {
6468

6569
this.#batches.delete(batch);
6670

71+
for (const [b, k] of this.#batches) {
72+
if (b === batch) break;
73+
74+
const offscreen = this.#offscreen.get(k);
75+
76+
if (offscreen) {
77+
destroy_effect(offscreen.effect);
78+
this.#offscreen.delete(k);
79+
}
80+
81+
this.#batches.delete(b);
82+
}
83+
84+
// outro/destroy effects
6785
for (const [k, effect] of this.#onscreen) {
6886
if (k === key) continue;
6987

0 commit comments

Comments
 (0)