Skip to content

Internally, duplicate keys are maintained #17

@fabien

Description

@fabien

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions