Skip to content

Commit 457b849

Browse files
committed
remove flush_effects method
1 parent a98c75e commit 457b849

File tree

1 file changed

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

1 file changed

+6
-11
lines changed

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ export class Batch {
341341

342342
flush() {
343343
if (queued_root_effects.length > 0) {
344-
this.flush_effects();
344+
flush_effects();
345345
} else {
346346
this.#commit();
347347
}
348348

349349
if (current_batch !== this) {
350-
// this can happen if a `flushSync` occurred during `this.flush_effects()`,
350+
// this can happen if a `flushSync` occurred during `flush_effects()`,
351351
// which is permitted in legacy mode despite being a terrible idea
352352
return;
353353
}
@@ -359,10 +359,6 @@ export class Batch {
359359
this.deactivate();
360360
}
361361

362-
flush_effects() {
363-
flush_effects();
364-
}
365-
366362
/**
367363
* Append and remove branches to/from the DOM
368364
*/
@@ -454,11 +450,10 @@ export function flushSync(fn) {
454450
try {
455451
var result;
456452

457-
const batch = Batch.ensure();
453+
var batch = Batch.ensure();
458454

459455
if (fn) {
460-
batch.flush_effects();
461-
456+
flush_effects();
462457
result = fn();
463458
}
464459

@@ -473,15 +468,15 @@ export function flushSync(fn) {
473468

474469
// TODO this feels wrong
475470
if (queued_root_effects.length === 0) {
476-
// this would be reset in `batch.flush_effects()` but since we are early returning here,
471+
// this would be reset in `flush_effects()` but since we are early returning here,
477472
// we need to reset it here as well in case the first time there's 0 queued root effects
478473
last_scheduled_effect = null;
479474

480475
return /** @type {T} */ (result);
481476
}
482477
}
483478

484-
batch.flush_effects();
479+
flush_effects();
485480
}
486481
} finally {
487482
is_flushing_sync = prev_flushing_sync;

0 commit comments

Comments
 (0)