Skip to content
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

use directives applied multiple times when re-ordering list for keyed each #3301

Closed
ghost opened this issue Jul 27, 2019 · 1 comment
Closed
Labels

Comments

@ghost
Copy link

ghost commented Jul 27, 2019

The use: directive seems to be re-applied to elements that correspond to items in an {#each} when the array is modified, if the {#each} has a key. Un-keyed each blocks seem to work fine.

Example: https://svelte.dev/repl/783c29378ad0475485f11f82888d0cf1?version=3.6.9

Each item has a directive that adds a click handler, and the click handler increases a number. If you click the "re-order" button it switches two elements in the array, and one of the nodes involved in the switch gets its click handler added again (so it will now increase the counter by 2 for each click).

@Conduitry Conduitry added the bug label Jul 29, 2019
@Conduitry
Copy link
Member

Duplicate of #2735.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant