Skip to content

Commit 8baf164

Browse files
committed
fix
1 parent 7762f29 commit 8baf164

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ export class Batch {
101101
} else {
102102
for (const e of this.render_effects) set_signal_status(e, CLEAN);
103103
for (const e of this.effects) set_signal_status(e, CLEAN);
104+
}
104105

105-
for (const [source, value] of current_values) {
106-
source.v = value;
107-
}
108-
109-
for (const effect of this.async_effects) {
110-
update_effect(effect);
111-
}
106+
for (const [source, value] of current_values) {
107+
source.v = value;
108+
}
112109

113-
this.async_effects = [];
110+
for (const effect of this.async_effects) {
111+
update_effect(effect);
114112
}
113+
114+
this.async_effects = [];
115115
}
116116

117117
/**

packages/svelte/tests/runtime-runes/samples/async-expression/_config.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import { flushSync, tick } from 'svelte';
2-
import { deferred } from '../../../../src/internal/shared/utils.js';
32
import { test } from '../../test';
43

5-
/** @type {ReturnType<typeof deferred>} */
6-
let d;
7-
84
export default test({
95
html: `
106
<button>reset</button>
@@ -13,10 +9,11 @@ export default test({
139
<p>pending</p>
1410
`,
1511

16-
async test({ assert, target }) {
12+
async test({ assert, target, raf }) {
1713
const [reset, hello, goodbye] = target.querySelectorAll('button');
1814

1915
flushSync(() => hello.click());
16+
raf.tick(0);
2017
await Promise.resolve();
2118
await Promise.resolve();
2219
await tick();
@@ -32,6 +29,7 @@ export default test({
3229
);
3330

3431
flushSync(() => reset.click());
32+
raf.tick(0);
3533
await tick();
3634
assert.htmlEqual(
3735
target.innerHTML,
@@ -40,10 +38,13 @@ export default test({
4038
<button>hello</button>
4139
<button>goodbye</button>
4240
<h1>hello</h1>
41+
<p>updating...</p>
4342
`
4443
);
4544

4645
flushSync(() => goodbye.click());
46+
await Promise.resolve();
47+
raf.tick(0);
4748
await tick();
4849
assert.htmlEqual(
4950
target.innerHTML,

packages/svelte/tests/runtime-runes/samples/async-expression/main.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
<svelte:boundary>
1010
<h1>{await deferred.promise}</h1>
1111

12+
{#if $effect.pending()}
13+
<p>updating...</p>
14+
{/if}
15+
1216
{#snippet pending()}
1317
<p>pending</p>
1418
{/snippet}

0 commit comments

Comments
 (0)