mirror of https://github.com/sveltejs/svelte
commit
fe6c00daa9
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
'svelte': patch
|
|
||||||
---
|
|
||||||
|
|
||||||
fix: invoke parent boundary of deriveds that throw
|
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'svelte': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: reset `is_flushing` if `flushSync` is called and there's no scheduled effect
|
||||||
@ -0,0 +1,6 @@
|
|||||||
|
<script>
|
||||||
|
let { data } = $props();
|
||||||
|
let { foo } = $state(data);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{foo}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
html: `bar`
|
||||||
|
});
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
<script>
|
||||||
|
import Child from './Child.svelte';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Child data={{ foo: 'bar' }} />
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
import { ok, test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const btn = target.querySelector('button');
|
||||||
|
const main = target.querySelector('main');
|
||||||
|
ok(main);
|
||||||
|
console.log(main.innerHTML);
|
||||||
|
assert.htmlEqual(main.innerHTML, `<div>true</div>`);
|
||||||
|
// we don't want to use flush sync (or tick that use it inside) since we are testing that calling `flushSync` once
|
||||||
|
// when there are no scheduled effects does not cause reactivity to break
|
||||||
|
btn?.click();
|
||||||
|
await Promise.resolve();
|
||||||
|
assert.htmlEqual(main.innerHTML, `<div>false</div> <div>false</div>`);
|
||||||
|
}
|
||||||
|
});
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
<script>
|
||||||
|
import { flushSync } from 'svelte'
|
||||||
|
|
||||||
|
let flag = $state(true)
|
||||||
|
let test = $state(true);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button onclick={()=>{
|
||||||
|
flushSync(() => {
|
||||||
|
test = !test
|
||||||
|
})
|
||||||
|
|
||||||
|
flag = !flag;
|
||||||
|
}}>switch</button>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div>{flag}</div>
|
||||||
|
|
||||||
|
{#if !flag}
|
||||||
|
<div>{test} </div>
|
||||||
|
{/if}
|
||||||
|
</main>
|
||||||
|
|
||||||
@ -0,0 +1 @@
|
|||||||
|
0, 1
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
let count = 0;
|
||||||
|
function* test(){
|
||||||
|
while (true) {
|
||||||
|
yield count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let [one, two] = $state(test())
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{one}, {two}
|
||||||
@ -0,0 +1 @@
|
|||||||
|
10, Admin
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
let [level, custom] = $state([10, "Admin"])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{level}, {custom}
|
||||||
Loading…
Reference in new issue