-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into schedule_effect_perf_without_branch
- Loading branch information
Showing
16 changed files
with
137 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: correctly migrate sequence expressions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'svelte': patch | ||
--- | ||
|
||
fix: avoid disconnecting deriveds that are still active |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
packages/svelte/tests/migrate/samples/derivations-no-colon/input.svelte
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
packages/svelte/tests/migrate/samples/derivations-no-colon/output.svelte
This file was deleted.
Oops, something went wrong.
6 changes: 5 additions & 1 deletion
6
packages/svelte/tests/migrate/samples/derivations/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
<script> | ||
let count = 0; | ||
// semicolon at the end | ||
$: doubled = count * 2; | ||
$: ({ quadrupled } = { quadrupled: count * 4 }); | ||
// no semicolon at the end | ||
$: time_8 = count * 8 | ||
$: ({ time_16 } = { time_16: count * 16 }) | ||
</script> | ||
|
||
{count} / {doubled} / {quadrupled} | ||
{count} / {doubled} / {quadrupled} / {time_8} / {time_16} |
6 changes: 5 additions & 1 deletion
6
packages/svelte/tests/migrate/samples/derivations/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
<script> | ||
let count = 0; | ||
// semicolon at the end | ||
let doubled = $derived(count * 2); | ||
let { quadrupled } = $derived({ quadrupled: count * 4 }); | ||
// no semicolon at the end | ||
let time_8 = $derived(count * 8) | ||
let { time_16 } = $derived({ time_16: count * 16 }) | ||
</script> | ||
|
||
{count} / {doubled} / {quadrupled} | ||
{count} / {doubled} / {quadrupled} / {time_8} / {time_16} |
14 changes: 14 additions & 0 deletions
14
packages/svelte/tests/migrate/samples/state-and-derivations-sequence/input.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
let count = (void 0, 0); | ||
// semicolon at the end | ||
$: doubled = (void 0, count * 2); | ||
$: ({ quadrupled } = (void 0, { quadrupled: count * 4 })); | ||
// no semicolon at the end | ||
$: time_8 = (void 0, count * 8) | ||
$: ({ time_16 } = (void 0, { time_16: count * 16 })) | ||
</script> | ||
|
||
<!-- reassign to migrate to state --> | ||
<button onclick={()=> count++}></button> | ||
|
||
{count} / {doubled} / {quadrupled} / {time_8} / {time_16} |
14 changes: 14 additions & 0 deletions
14
packages/svelte/tests/migrate/samples/state-and-derivations-sequence/output.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<script> | ||
let count = $state((void 0, 0)); | ||
// semicolon at the end | ||
let doubled = $derived((void 0, count * 2)); | ||
let { quadrupled } = $derived((void 0, { quadrupled: count * 4 })); | ||
// no semicolon at the end | ||
let time_8 = $derived((void 0, count * 8)) | ||
let { time_16 } = $derived((void 0, { time_16: count * 16 })) | ||
</script> | ||
|
||
<!-- reassign to migrate to state --> | ||
<button onclick={()=> count++}></button> | ||
|
||
{count} / {doubled} / {quadrupled} / {time_8} / {time_16} |
19 changes: 19 additions & 0 deletions
19
packages/svelte/tests/runtime-runes/samples/if-block-dependencies/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { flushSync } from 'svelte'; | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
async test({ assert, target }) { | ||
await Promise.resolve(); | ||
|
||
let [btn1] = target.querySelectorAll('button'); | ||
|
||
flushSync(() => { | ||
btn1?.click(); | ||
}); | ||
|
||
assert.htmlEqual( | ||
target.innerHTML, | ||
`false\ntrue\n<button>Toggle</button>\nfirst:\nfalse\n<br>\nsecond:\ntrue` | ||
); | ||
} | ||
}); |
21 changes: 21 additions & 0 deletions
21
packages/svelte/tests/runtime-runes/samples/if-block-dependencies/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<script> | ||
let first = $state(true) | ||
let second = $state(false) | ||
let derivedSecond = $derived(second) | ||
queueMicrotask(() => { | ||
first = false | ||
}); | ||
</script> | ||
|
||
{first} {second} | ||
|
||
<button onclick={() => { | ||
second = true | ||
}}>Toggle</button> | ||
|
||
{#if first || derivedSecond} | ||
first: {first} | ||
<br /> | ||
second: {derivedSecond} | ||
{/if} |