Skip to content

setDataValue sets attribute as changed when updated from null to null #5004

@Thomathan

Description

@Thomathan

Related to #3812

The setDataValue will set an attribute as changed when changing from null to null.

It could be argued that I should have that check in my own code but the instance code does check for changes anyways.

Instance.prototype.setDataValue = function(key, value) {
  var originalValue = this._previousDataValues[key];
  if (!Utils.isPrimitive(value) || value !== originalValue) {
    this.changed(key, true);
  }

  this.dataValues[key] = value;
};

This differs from the set function which does

if (!options.raw && ((!Utils.isPrimitive(value) && value !== null) || value !== originalValue)) {
  this._previousDataValues[key] = originalValue;
  this.changed(key, true);
}
this.dataValues[key] = value;

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugDEPRECATED: replace with the "bug" issue type

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions