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

Internally, duplicate keys are maintained #17

Open
fabien opened this issue Feb 5, 2011 · 3 comments
Open

Internally, duplicate keys are maintained #17

fabien opened this issue Feb 5, 2011 · 3 comments
Labels

Comments

@fabien
Copy link
Contributor

fabien commented Feb 5, 2011

There's a bug in Dirty.prototype.set() where keys are pushed onto _keys, even though they have already been set. This is immediately noticeable when iterating using forEach.

The fix is very simple:

if (!this._keys[key]) { // FAIL - _keys is an Array
  this._keys.push(key);
}

should of course be:

if (this._keys.indexOf(key) === -1) { // FIXED    
  this._keys.push(key);
}
@dylang
Copy link

dylang commented Feb 15, 2011

Having this problem too. Thought I was going crazy until I switched to an older version of Dirty. Every set results in another key being created.

@milesw
Copy link

milesw commented Feb 28, 2011

Same thing happening here. Not crazy after all...

@danmilon
Copy link

Affected also!

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

4 participants