Skip to content

Commit 693262a

Browse files
committed
fix
1 parent 48a781e commit 693262a

File tree

1 file changed

+6
-10
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+6
-10
lines changed

packages/svelte/src/internal/client/reactivity/batch.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,26 +62,22 @@ export class Batch {
6262

6363
var current_values = new Map();
6464

65+
for (const [source, current] of this.#current) {
66+
current_values.set(source, source.v);
67+
source.v = current;
68+
}
69+
6570
for (const batch of batches) {
6671
if (batch === this) continue;
6772

6873
for (const [source, previous] of batch.#previous) {
69-
if (!this.#current.has(source)) {
74+
if (!current_values.has(source)) {
7075
current_values.set(source, source.v);
7176
source.v = previous;
7277
}
7378
}
7479
}
7580

76-
for (const [source, current] of this.#current) {
77-
current_values.set(source, source.v);
78-
79-
// TODO this shouldn't be necessary, but tests fail otherwise,
80-
// presumably because we need a try-finally somewhere, and the
81-
// source wasn't correctly reverted after the previous batch
82-
source.v = current;
83-
}
84-
8581
for (const root of root_effects) {
8682
process_effects(this, root);
8783
}

0 commit comments

Comments
 (0)