pull/16197/head
Rich Harris 5 months ago
parent 6f8abda561
commit 48293d205d

@ -107,12 +107,7 @@ export class Batch {
this.render_effects = []; this.render_effects = [];
this.effects = []; this.effects = [];
// commit changes this.commit();
for (const fn of this.#callbacks) {
fn();
}
this.#callbacks.clear();
flush_queued_effects(render_effects); flush_queued_effects(render_effects);
flush_queued_effects(effects); flush_queued_effects(effects);
@ -174,12 +169,25 @@ export class Batch {
fn(); fn();
} }
commit() {
// commit changes
for (const fn of this.#callbacks) {
fn();
}
this.#callbacks.clear();
}
increment() { increment() {
this.#pending += 1; this.#pending += 1;
} }
decrement() { decrement() {
this.#pending -= 1; this.#pending -= 1;
if (this.#pending === 0) {
this.commit();
}
} }
settled() { settled() {

@ -2,11 +2,6 @@ import { flushSync } from 'svelte';
import { test } from '../../test'; import { test } from '../../test';
export default test({ export default test({
html: `
<button>show</button>
<p>pending</p>
`,
async test({ assert, target }) { async test({ assert, target }) {
const button = target.querySelector('button'); const button = target.querySelector('button');

Loading…
Cancel
Save