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
[date].svelte? [sm]:9 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '5')
at [date].svelte? [sm]:9:60
at Array.reduce (<anonymous>)
at get_each_context ([date].svelte? [sm]:9:26)
at create_fragment ([date].svelte? [sm]:8:7)
at init (index.mjs:1877:37)
at new U5Bdateu5D ([date].svelte? [sm]:4:32)
at createProxiedComponent (svelte-hooks.js:266:9)
at new ProxyComponent (proxy.js:239:20)
at new Proxy<[date]> (proxy.js:346:11)
at Array.create_else_block (root.svelte? [sm]:43:40)
"by using const tag" in REPL: (only on initial visit of REPL)
index.da61f847.js:60 Error: Could not load https://unpkg.com/[email protected]/internal/index.mjs (imported by ./App.svelte):
at R (index.da61f847.js:21:834)
at tn (index.da61f847.js:51:3364)
at index.da61f847.js:51:21283
at async index.da61f847.js:51:8510
at async Zu.work (index.da61f847.js:51:2752)
"now not deconstructed" in REPL: (no log in SvelteKit shown, only 500 error above)
index.da61f847.js:60 Error: Assigning to rvalue (Note that you need plugins to import files that are not JavaScript)
at R (index.da61f847.js:21:834)
at re.error (index.da61f847.js:28:123491)
at re.tryParse (index.da61f847.js:28:131909)
at re.setSource (index.da61f847.js:28:129343)
at ic.addModuleSource (index.da61f847.js:51:9316)
Your REPL that creates the error Cannot read properties of undefined (reading '5'). seems to be a slightly different manifestation of #7423. Underlying cause appears to be the same, looking at the generated code.
Describe the bug
I got some weird behavior using the const tag inside an each block which also contains another each block.
I'm trying to use a data structure like this:
Straight forward enough.
Now I want to display the sum of each object's
item.val
s inside thedata
array and then also display eachitem.val
.Something like this works (REPL)
Now let's say I need to sum multiple times and I want to use the const tag (REPL)
By adding the const tag Svelte errors out with
Cannot read properties of undefined (reading '5')
.Removing the inner each block resolves the error.
I also tried not deconstructing inside the nested each (REPL)
This produces different errors:
Assigning to rvalue (Note that you need plugins to import files that are not JavaScript)
500 Invalid destructuring assignment target SyntaxError: Invalid destructuring assignment target
And now the best part: if I rename
item
inside the nested block, it works again (REPL)This is terrifying and makes me want to not use the const tag again, which is sad because It's a pretty neat feature.
Reproduction
same as linked above
item
Logs
"by using const tag" in SvelteKit:
"by using const tag" in REPL: (only on initial visit of REPL)
"now not deconstructed" in REPL: (no log in SvelteKit shown, only 500 error above)
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: