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

@ -101,17 +101,17 @@ export class Batch {
} else {
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 [source, value] of current_values) {
source.v = value;
}
for (const effect of this.async_effects) {
update_effect(effect);
}
for (const [source, value] of current_values) {
source.v = value;
}
this.async_effects = [];
for (const effect of this.async_effects) {
update_effect(effect);
}
this.async_effects = [];
}
/**

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

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

Loading…
Cancel
Save