Skip to content

Commit eac029c

Browse files
committed
fix/simplify
1 parent b5028dc commit eac029c

File tree

1 file changed

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

1 file changed

+2
-7
lines changed

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ let queued_root_effects = [];
5959
let last_scheduled_effect = null;
6060

6161
let is_flushing = false;
62-
let in_flush_sync = false;
6362

6463
export class Batch {
6564
/**
@@ -417,7 +416,7 @@ export class Batch {
417416
return (this.#deferred ??= deferred()).promise;
418417
}
419418

420-
static ensure() {
419+
static ensure(in_flush_sync = false) {
421420
if (current_batch === null) {
422421
const batch = (current_batch = new Batch());
423422
batches.add(current_batch);
@@ -446,15 +445,13 @@ export class Batch {
446445
* @returns {T}
447446
*/
448447
export function flushSync(fn) {
449-
in_flush_sync = true;
450-
451448
if (async_mode_flag && active_effect !== null) {
452449
e.flush_sync_in_effect();
453450
}
454451

455452
var result;
456453

457-
const batch = Batch.ensure();
454+
const batch = Batch.ensure(true);
458455

459456
if (fn) {
460457
batch.flush_effects();
@@ -478,8 +475,6 @@ export function flushSync(fn) {
478475
dev_effect_stack = [];
479476
}
480477

481-
in_flush_sync = false;
482-
483478
return /** @type {T} */ (result);
484479
}
485480

0 commit comments

Comments
 (0)