Skip to content

Commit d5ba3e2

Browse files
committed
preserve newer batches
1 parent b9208db commit d5ba3e2

File tree

1 file changed

+8
-5
lines changed
  • packages/svelte/src/internal/client/dom/blocks

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,22 @@ export class BranchManager {
7979
}
8080
}
8181

82-
this.#batches.delete(batch);
83-
8482
for (const [b, k] of this.#batches) {
85-
if (b === batch) break;
83+
this.#batches.delete(b);
84+
85+
if (b === batch) {
86+
// keep values for newer batches
87+
break;
88+
}
8689

8790
const offscreen = this.#offscreen.get(k);
8891

8992
if (offscreen) {
93+
// for older batches, destroy offscreen effects
94+
// as they will never be committed
9095
destroy_effect(offscreen.effect);
9196
this.#offscreen.delete(k);
9297
}
93-
94-
this.#batches.delete(b);
9598
}
9699

97100
// outro/destroy effects

0 commit comments

Comments
 (0)