remove flush_effects method

pull/16482/head
Rich Harris 2 months ago
parent a98c75ea31
commit 457b849530

@ -341,13 +341,13 @@ export class Batch {
flush() { flush() {
if (queued_root_effects.length > 0) { if (queued_root_effects.length > 0) {
this.flush_effects(); flush_effects();
} else { } else {
this.#commit(); this.#commit();
} }
if (current_batch !== this) { if (current_batch !== this) {
// this can happen if a `flushSync` occurred during `this.flush_effects()`, // this can happen if a `flushSync` occurred during `flush_effects()`,
// which is permitted in legacy mode despite being a terrible idea // which is permitted in legacy mode despite being a terrible idea
return; return;
} }
@ -359,10 +359,6 @@ export class Batch {
this.deactivate(); this.deactivate();
} }
flush_effects() {
flush_effects();
}
/** /**
* Append and remove branches to/from the DOM * Append and remove branches to/from the DOM
*/ */
@ -454,11 +450,10 @@ export function flushSync(fn) {
try { try {
var result; var result;
const batch = Batch.ensure(); var batch = Batch.ensure();
if (fn) { if (fn) {
batch.flush_effects(); flush_effects();
result = fn(); result = fn();
} }
@ -473,7 +468,7 @@ export function flushSync(fn) {
// TODO this feels wrong // TODO this feels wrong
if (queued_root_effects.length === 0) { if (queued_root_effects.length === 0) {
// this would be reset in `batch.flush_effects()` but since we are early returning here, // this would be reset in `flush_effects()` but since we are early returning here,
// we need to reset it here as well in case the first time there's 0 queued root effects // we need to reset it here as well in case the first time there's 0 queued root effects
last_scheduled_effect = null; last_scheduled_effect = null;
@ -481,7 +476,7 @@ export function flushSync(fn) {
} }
} }
batch.flush_effects(); flush_effects();
} }
} finally { } finally {
is_flushing_sync = prev_flushing_sync; is_flushing_sync = prev_flushing_sync;

Loading…
Cancel
Save