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

Fix: bind:this in each with objects\array #4759

Merged
merged 3 commits into from
May 3, 2020

Conversation

Th0rN13
Copy link
Contributor

@Th0rN13 Th0rN13 commented May 1, 2020

Fix #4686

Code from issue

{#each entries as { itemId, entry } (itemId)}
	<div bind:this={items1[itemId]} />
	<div bind:this={items2[itemId]} />
{/each}

Adding dependecies only use single variable name (itemId), but it can be too hard to detect what array items1[itemId] and items2[itemId] are different.
If you use it carefully, there will be no problems. Also, detecting different variable names can be bypassed by using variable reference (something like let items1 = []; let items2 = items1;)

Also i add two tests (one with object props, and one with spread)

PS: also i look to issue #4636, but this is another issue that is not directly related to this one

@Conduitry Conduitry merged commit a73be39 into sveltejs:master May 3, 2020
@tanhauhau tanhauhau mentioned this pull request Jun 1, 2020
4 tasks
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compilation fails when using two bind:this to array/object with same key
2 participants