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

Compilation fails when using two bind:this to array/object with same key #4686

Closed
darxis opened this issue Apr 17, 2020 · 6 comments · Fixed by #4759
Closed

Compilation fails when using two bind:this to array/object with same key #4686

darxis opened this issue Apr 17, 2020 · 6 comments · Fixed by #4759
Labels

Comments

@darxis
Copy link

darxis commented Apr 17, 2020

Compilation fails when using two bind:this to array/object with same key
Error msg: Variable 'xxx' already initialised with a different value

Bug (version 3.20.1)
https://svelte.dev/repl/5d29d37523c14015b3d79fa53d21e1dd?version=3.20.1

Bug didn't exist in version 3.10.1 (haven't checked other versions tho):
https://svelte.dev/repl/5d29d37523c14015b3d79fa53d21e1dd?version=3.10.1

Note that this bug occurs when there is more than 1 component, if using 1 component it works.

Edit 1:
This bug occurs both when using destruction in each and without using it

@darxis darxis changed the title Compilation fails when using bind:this to two array/object with same key Compilation fails when using two bind:this to array/object with same key Apr 17, 2020
@Oreilles
Copy link

I don't think it's a bug. Your variable is already binded to the DOM element corresponding to the first Comp component, so it can't be binded again to another DOM element. Why would you need to bind two elements to the same variable ?

@darxis
Copy link
Author

darxis commented Apr 18, 2020

@Oreilles
I created a new REPL showing in some context what I am trying to achieve:

https://svelte.dev/repl/1e2c16c929a64890adeddf7fa9d65fa1?version=3.20.1

When using just one of the <BootstrapToggle /> the code compiles fine

@Oreilles
Copy link

Oh, I missed that it was two different arrays items1 and items2 in your first example. Seems like a bug indeed.

@antony
Copy link
Member

antony commented Apr 18, 2020

The second REPL is far too complicated. This does however look like a bug. Very strange.

@antony antony added the bug label Apr 18, 2020
@pushkine
Copy link
Contributor

related #4636

@Conduitry
Copy link
Member

This has been fixed in 3.22.0 - https://svelte.dev/repl/5d29d37523c14015b3d79fa53d21e1dd?version=3.22.0

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.

5 participants