mirror of https://github.com/sveltejs/svelte
Merge 8250b92982 into 435da13fdd
commit
1758b9743c
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: ensure unresolved async deriveds return undefined instead of internal symbol
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
<script>
|
||||||
|
let foo = $state(null);
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
foo = 69;
|
||||||
|
});
|
||||||
|
|
||||||
|
let bar = $derived(await 1);
|
||||||
|
let baz = $derived(foo ? foo * bar : null);
|
||||||
|
|
||||||
|
const qux = "qux";
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p id="bar">bar: {bar}</p>
|
||||||
|
<p id="baz">baz: {baz}</p>
|
||||||
|
{#if qux}
|
||||||
|
<p></p>
|
||||||
|
{/if}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { tick } from 'svelte';
|
||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
// Ensure async derived remains reactive with associated effect and boundary with guard (#17271)
|
||||||
|
//
|
||||||
|
// Accounts for both UNINITIALIZED leaking from get and the baz derived remaining NaN
|
||||||
|
// due to having both an $effect and a boundary with an if in the same template
|
||||||
|
export default test({
|
||||||
|
html: `<p>Loading...</p>`,
|
||||||
|
|
||||||
|
skip_no_async: true,
|
||||||
|
|
||||||
|
async test({ assert, target }) {
|
||||||
|
await tick();
|
||||||
|
|
||||||
|
assert.htmlEqual(
|
||||||
|
target.innerHTML,
|
||||||
|
`
|
||||||
|
<p id="bar">bar: 1</p>
|
||||||
|
<p id="baz">baz: 69</p>
|
||||||
|
<p></p>
|
||||||
|
`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:boundary>
|
||||||
|
{#snippet pending()}
|
||||||
|
<p>Loading...</p>
|
||||||
|
{/snippet}
|
||||||
|
|
||||||
|
<Child />
|
||||||
|
</svelte:boundary>
|
||||||
Loading…
Reference in new issue