-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component doesn't get removed in #each with no props/children #3035
Comments
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. |
remove components without props from each block
No idea how this bug survived in the wild so long. Fixed in 3.6.0 |
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.The text was updated successfully, but these errors were encountered: