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

Svelte confused when handling component-event, using same #each-alias for different arrays, and replacing item in array #1184

Closed
aphitiel opened this issue Feb 23, 2018 · 2 comments
Labels

Comments

@aphitiel
Copy link
Contributor

Sorry for the crappy title, guess it's an edge-case;)

I have two lists using the same component. The component fires an event that invokes a method, passing the current item from the list. This method replaces an item in the list.

At the next click it gets passed the old item, if

  • there are 2 #eaches
  • both use the same alias
  • the method gets invoked from a component
  • the array-item gets replaced, not mutated

Here's a REPL that's hopefully a bit more understandable.

@Rich-Harris
Copy link
Member

good news, I've just checked this against #1173 and it looks like it's already fixed!

@Rich-Harris
Copy link
Member

Confirmation that this works in 1.56: https://svelte.technology/repl?version=1.56.0&gist=4b3699547365bd2dd432d3f70929553d. Thanks!

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

2 participants