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

Array binding not works properly. #3243

Closed
kapilpipaliya opened this issue Jul 14, 2019 · 10 comments · Fixed by #4868
Closed

Array binding not works properly. #3243

kapilpipaliya opened this issue Jul 14, 2019 · 10 comments · Fixed by #4868
Labels

Comments

@kapilpipaliya
Copy link

https://svelte.dev/repl/ee58338160ab47aca08181cec39f1360?version=3.6.7

@kapilpipaliya
Copy link
Author

kapilpipaliya commented Jul 15, 2019

@kapilpipaliya
Copy link
Author

This one clearly shows the problem:
https://svelte.dev/repl/496d2e50d066406cbe6dfa3aab2bd18b?version=3.6.7

@Egnus
Copy link

Egnus commented Jul 15, 2019

I can confirm something strange and unexpected is happening, arrays of arrays are stacking their bindings together.
Click 3 or more checkboxes from different groups and check how the pool is getting filled all mixed between then.
https://svelte.dev/repl/f0bf97fb63db4bf6a44108cf11437cd8?version=3.6.7

@silentworks
Copy link

silentworks commented Jul 15, 2019

Here is a more verbose example which is also using keys but still suffer from the same problem.

https://svelte.dev/repl/116356aaaf0d49669be609064c3bd0a9?version=3.6.7

I have also created the lists manually just to make sure that it wasn't the {#each} loop causing the issue and the problem seem to persists.

https://svelte.dev/repl/d487732496574e1286837f07ae533872?version=3.6.7

@Amn3s1a2018
Copy link

Noticed too...
Somehow fixes the problem, if you move the inner each block to a separate component.

https://svelte.dev/repl/b1832504a78a4fc7853148c711d5c916?version=3.6.7

@Conduitry Conduitry added the bug label Sep 12, 2019
@kapilpipaliya
Copy link
Author

@Amn3s1a2018
Copy link

Same as earlier.
https://svelte.dev/repl/e3f8192a80964087b9844486efac535b?version=3.16.5

@hugosenari
Copy link

https://svelte.dev/tutorial/each-block-bindings
'Remaning' not working as expected, it should count only not done

$: remaining = todos.filter(t => !t.done).length;

@Conduitry
Copy link
Member

It does if you complete the tutorial with the bind: statements as directed.

@Conduitry
Copy link
Member

Using bind:group inside of an {#each} should work now in 3.23.2 with the addition of #4868.

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

Successfully merging a pull request may close this issue.

7 participants