Repro: https://svelte.dev/repl/8d5bc96db7634fe0b898b6755b0e7b90?version=3.5.1
Hit the add button, works. Hit the remove button, it fails!
If you add any property to MyComp or give it children, then the remove button begins to work.
You must use unique keys on list items so that Svelte knows which item to delete. Please, read this part of documentation for a better understanding: Svelte:each
Fix your code, show in 15 line: REPL
@UnwrittenFun, not sure about the completeness of my previous comment. But this may be the solution
This case is broken in 3.5.2 even with unique keys (REPL). Try to click on the remove button.
The original issue is a bug — without a specified key, it should behave as though you'd done this:
{#each arr as item, i (i)}
<MyComp />
{/each}
The keyed case is fixed in 3.5.3.
No idea how this bug survived in the wild so long. Fixed in 3.6.0
Most helpful comment
The original issue is a bug — without a specified key, it should behave as though you'd done this:
The keyed case is fixed in 3.5.3.