-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: read index as a source in legacy keyed each block (#14208)
Fixes #14203
- Loading branch information
1 parent
ea0d80e
commit 53af138
Showing
5 changed files
with
31 additions
and
2 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: read index as a source in legacy keyed each block |
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
5 changes: 5 additions & 0 deletions
5
packages/svelte/tests/runtime-legacy/samples/keyed-each-bind-read-index/Component.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,5 @@ | ||
<script> | ||
export let item; | ||
console.log(item); | ||
item = 1; | ||
</script> |
9 changes: 9 additions & 0 deletions
9
packages/svelte/tests/runtime-legacy/samples/keyed-each-bind-read-index/_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,9 @@ | ||
import { test } from '../../test'; | ||
|
||
export default test({ | ||
async test({ assert, target, logs }) { | ||
const p = target.querySelector('p'); | ||
assert.equal(p?.innerHTML, '1'); | ||
assert.deepEqual(logs, [0]); | ||
} | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/svelte/tests/runtime-legacy/samples/keyed-each-bind-read-index/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,10 @@ | ||
<script> | ||
import Component from './Component.svelte'; | ||
const items = [0]; | ||
</script> | ||
|
||
{#each items as item, idx(item)} | ||
<Component bind:item /> | ||
{/each} | ||
|
||
<p>{items}</p> |