You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A while back, I went out and fixed #6609 with #8386, which deals with destructuring objects with dynamic (computed) keys in the markup. Since then, I noticed a bug. When both an each block (or await block) and const tags have dynamic keys (or two const tags both having dynamic keys), for example,
<script>
let array = [[[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[1, 2, 3], [4, 5, 6], [7, 8, 9]], [[1, 2, 3], [4, 5, 6], [7, 8, 9]]];
let zero = 0;
let one = 1;
let two = 2;
</script>
{#each array as { [zero]: firstArr, [one]: secondArr } }
{@const { [zero]: f, [one]: s } = firstArr }
<p>{f}</p>
<p>{s}</p>
{/each}
An error saying Identifier 'computed_property_0' has already been declared. (by the way, if you open the REPL down below, you could also see the error on the console if you go on developer tools.
Being the one who created this bug, I have already made a pull request fixing this issue.
Fixes#8417
The issue is that unpack_destructuring in each blocks, await blocks, and @const tags were making computed_props independently. This causes computed_props_# to conflict when each blocks were used with @const tags, or await blocks and @const tags, or consecutive @const tags together. Therefore, one solution is to use component.get_unique_name to, well, make unique names and never get conflicts.
Describe the bug
A while back, I went out and fixed #6609 with #8386, which deals with destructuring objects with dynamic (computed) keys in the markup. Since then, I noticed a bug. When both an each block (or await block) and const tags have dynamic keys (or two const tags both having dynamic keys), for example,
An error saying
Identifier 'computed_property_0' has already been declared
. (by the way, if you open the REPL down below, you could also see the error on the console if you go on developer tools.Being the one who created this bug, I have already made a pull request fixing this issue.
Reproduction
https://svelte.dev/repl/0015b623667b4be795b6479980088f46?version=3.57.0
Logs
Identifier 'computed_property_0' has already been declared
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: