mirror of https://github.com/sveltejs/svelte
parent
53fdd0f93a
commit
d3a01bd5a7
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: always mark reactions of deriveds
|
@ -0,0 +1,56 @@
|
||||
import { tick } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
await tick();
|
||||
|
||||
const [a, b, update] = target.querySelectorAll('button');
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>a</button>
|
||||
<button>b</button>
|
||||
<button>0</button>
|
||||
<h1>a</h1>
|
||||
`
|
||||
);
|
||||
|
||||
b.click();
|
||||
await tick();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>a</button>
|
||||
<button>b</button>
|
||||
<button>0</button>
|
||||
<h1>b</h1>
|
||||
`
|
||||
);
|
||||
|
||||
update.click();
|
||||
await tick();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>a</button>
|
||||
<button>b</button>
|
||||
<button>1</button>
|
||||
<h1>b</h1>
|
||||
`
|
||||
);
|
||||
|
||||
a.click();
|
||||
await tick();
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>a</button>
|
||||
<button>b</button>
|
||||
<button>1</button>
|
||||
<h1>a</h1>
|
||||
`
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,26 @@
|
||||
<script>
|
||||
let object = $state(null);
|
||||
let count = $state(0);
|
||||
|
||||
const condition = $derived(object === null);
|
||||
</script>
|
||||
|
||||
<svelte:boundary>
|
||||
<button onclick={() => (object = null)}>a</button>
|
||||
<button onclick={() => (object = {})}>b</button>
|
||||
|
||||
<button onclick={async () => {
|
||||
count++;
|
||||
await Promise.resolve();
|
||||
object = {};
|
||||
}}>{await count}</button>
|
||||
|
||||
{#if condition}
|
||||
<h1>a</h1>
|
||||
{:else}
|
||||
<h1>b</h1>
|
||||
{/if}
|
||||
|
||||
{#snippet pending()}{/snippet}
|
||||
</svelte:boundary>
|
||||
|
Loading…
Reference in new issue