fix: ensure correct order of template effect values (#16655)

Compiler does sync then async but `memoizer.apply` did it the other way around
pull/16642/head
Simon H 2 weeks ago committed by GitHub
parent 11a2d8e937
commit acd9eaf2ec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: ensure correct order of template effect values

@ -34,7 +34,7 @@ export class Memoizer {
} }
apply() { apply() {
return [...this.#async, ...this.#sync].map((memo, i) => { return [...this.#sync, ...this.#async].map((memo, i) => {
memo.id.name = `$${i}`; memo.id.name = `$${i}`;
return memo.id; return memo.id;
}); });

@ -0,0 +1,9 @@
import { tick } from 'svelte';
import { ok, test } from '../../test';
export default test({
async test({ assert, target }) {
await tick();
assert.htmlEqual(target.innerHTML, '<p>foo bar</p>');
}
});

@ -0,0 +1,17 @@
<script>
function foo() {
return 'foo';
}
async function bar() {
return Promise.resolve('bar');
}
</script>
<svelte:boundary>
<p>{foo()} {await bar()}</p>
{#snippet pending()}
<p>pending</p>
{/snippet}
</svelte:boundary>
Loading…
Cancel
Save