Skip to content

Commit 6a3d785

Browse files
committed
fix
1 parent 5dee720 commit 6a3d785

File tree

1 file changed

+15
-7
lines changed
  • packages/svelte/src/internal/client/reactivity

1 file changed

+15
-7
lines changed

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ export class Batch {
299299

300300
deactivate() {
301301
current_batch = null;
302+
303+
flush_pending_update();
302304
}
303305

304306
neuter() {
@@ -322,13 +324,7 @@ export class Batch {
322324
batches.delete(this);
323325
}
324326

325-
current_batch = null;
326-
327-
for (const update of effect_pending_updates) {
328-
effect_pending_updates.delete(update);
329-
update();
330-
break;
331-
}
327+
this.deactivate();
332328
}
333329

334330
flush_effects() {
@@ -429,6 +425,18 @@ export class Batch {
429425
}
430426
}
431427

428+
function flush_pending_update() {
429+
for (const update of effect_pending_updates) {
430+
effect_pending_updates.delete(update);
431+
update();
432+
433+
if (current_batch !== null) {
434+
// only do one at a time
435+
break;
436+
}
437+
}
438+
}
439+
432440
/**
433441
* Synchronously flush any pending updates.
434442
* Returns void if no callback is provided, otherwise returns the result of calling the callback.

0 commit comments

Comments
 (0)