iamshaunjp / iamshaunjp/svelte-tutorial
Runtime error in Lesson #24 - Adding New Polls
- Dominant language
- No language data
- Stars
- 197
- Forks
- 111
- PR merge metrics
- No merged PRs in 30d
Description
At 8:18 in `PollList.svelte`, passing the id in `poll(id)` will throw a runtime error in Chrome and prevent the view to update in the Current Polls tab:
```
Uncaught (in promise) Error: Cannot have duplicate keys in a keyed each
at validate_each_keys (index.mjs:1218)
at create_fragment$4 (PollList.svelte:8)
at init (index.mjs:1489)
at new PollList (PollList.svelte:2)
at Array.create_if_block (App.svelte:50)
at Object.update [as p] (App.svelte:49)
at update (index.mjs:764)
at flush (index.mjs:732)
```
I believe it is related to this issue [#4301](https://github.com/sveltejs/svelte/issues/4301).
To solve this, I just pass the poll without the id but it may cause problems in the following lessons.
```
{#each polls as poll}
{/each}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.