pull/16197/head
Rich Harris 5 months ago
parent 7762f29260
commit 8baf1644a7

@ -101,6 +101,7 @@ export class Batch {
} else { } else {
for (const e of this.render_effects) set_signal_status(e, CLEAN); for (const e of this.render_effects) set_signal_status(e, CLEAN);
for (const e of this.effects) set_signal_status(e, CLEAN); for (const e of this.effects) set_signal_status(e, CLEAN);
}
for (const [source, value] of current_values) { for (const [source, value] of current_values) {
source.v = value; source.v = value;
@ -112,7 +113,6 @@ export class Batch {
this.async_effects = []; this.async_effects = [];
} }
}
/** /**
* @param {Source} source * @param {Source} source

@ -1,10 +1,6 @@
import { flushSync, tick } from 'svelte'; import { flushSync, tick } from 'svelte';
import { deferred } from '../../../../src/internal/shared/utils.js';
import { test } from '../../test'; import { test } from '../../test';
/** @type {ReturnType<typeof deferred>} */
let d;
export default test({ export default test({
html: ` html: `
<button>reset</button> <button>reset</button>
@ -13,10 +9,11 @@ export default test({
<p>pending</p> <p>pending</p>
`, `,
async test({ assert, target }) { async test({ assert, target, raf }) {
const [reset, hello, goodbye] = target.querySelectorAll('button'); const [reset, hello, goodbye] = target.querySelectorAll('button');
flushSync(() => hello.click()); flushSync(() => hello.click());
raf.tick(0);
await Promise.resolve(); await Promise.resolve();
await Promise.resolve(); await Promise.resolve();
await tick(); await tick();
@ -32,6 +29,7 @@ export default test({
); );
flushSync(() => reset.click()); flushSync(() => reset.click());
raf.tick(0);
await tick(); await tick();
assert.htmlEqual( assert.htmlEqual(
target.innerHTML, target.innerHTML,
@ -40,10 +38,13 @@ export default test({
<button>hello</button> <button>hello</button>
<button>goodbye</button> <button>goodbye</button>
<h1>hello</h1> <h1>hello</h1>
<p>updating...</p>
` `
); );
flushSync(() => goodbye.click()); flushSync(() => goodbye.click());
await Promise.resolve();
raf.tick(0);
await tick(); await tick();
assert.htmlEqual( assert.htmlEqual(
target.innerHTML, target.innerHTML,

@ -9,6 +9,10 @@
<svelte:boundary> <svelte:boundary>
<h1>{await deferred.promise}</h1> <h1>{await deferred.promise}</h1>
{#if $effect.pending()}
<p>updating...</p>
{/if}
{#snippet pending()} {#snippet pending()}
<p>pending</p> <p>pending</p>
{/snippet} {/snippet}

Loading…
Cancel
Save