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

dom-repeat: Duplicate values result in unsynchronized data #1913

Closed
kevinpschaaf opened this issue Jun 19, 2015 · 5 comments
Closed

dom-repeat: Duplicate values result in unsynchronized data #1913

kevinpschaaf opened this issue Jun 19, 2015 · 5 comments
Assignees

Comments

@kevinpschaaf
Copy link
Member

The collection-based key abstraction currently assumes unique array element identity.

Problem can be observed here (type bbbbb in the top input, and observe data out of sync):
http://jsbin.com/rabize/edit?html,output

@kevinpschaaf kevinpschaaf self-assigned this Jun 19, 2015
@kevinpschaaf kevinpschaaf changed the title dom-repeat: Duplicate primitive values result in unsynchronized data dom-repeat: Duplicate values result in unsynchronized data Jun 22, 2015
kevinpschaaf added a commit that referenced this issue Jun 30, 2015
This is a brute-force approach that might be too aggressive.  It would be nice to find a convenient place to opt-in to this.
@zmoshansky
Copy link

+1, this would be really nice to have.
The workaround as suggested #2667 (comment) is to wrap primitives in an object.
['analgesic', null, 'analgesic' ] -> [{k: 'analgesic'}, {k: null}, {k: 'analgesic'}]

@luna-duclos
Copy link

I've come across this issue as well, it's quite a big problem when having an array of any non object type

@rwestlund
Copy link

I just ran into this with 1.4.0, but I don't believe I have duplicate values in my string array.

I have this tap handler:

addStep: function() {
    this.push("recipe.directions", "");
}

and I'm using paper-inputs for each recipe.directions element within dom-repeat. I'm adding text to each step before I add the next one, so I don't think there are ever duplicate values.

I found the following workaround:

this.push("recipe.directions", new String());

This likely works because typeof new String() === 'object'

@Pupix
Copy link

Pupix commented May 11, 2016

@kevinpschaaf are you still working on this? Would be nice to not have such a constrain on value uniqueness, especially when talking about binding on form inputs.

@TimvdLippe
Copy link
Contributor

Original JSBin is now working correctly with Polymer 2, thus I am closing this issue.

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

No branches or pull requests

7 participants