iamshaunjp / iamshaunjp/svelte-tutorial

Runtime error in Lesson #24 - Adding New Polls

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
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}

{poll.question}

{/each}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.