Skip to content

Commit

Permalink
data.RecordFactory: record class => get isModified() #6274
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiu committed Jan 22, 2025
1 parent 9d2ca88 commit 365be71
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/data/RecordFactory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ class RecordFactory extends Base {

[dataSymbol] = {}

get isModified() {
let me = this;

if (model.trackModifiedFields) {
return Neo.isEqual(me[dataSymbol], me[initialDataSymbol])
}

return me._isModified
}

/**
* @param {Object} config
*/
Expand Down Expand Up @@ -189,15 +199,10 @@ class RecordFactory extends Base {

/**
* @param {Object} record
* @param {Boolean} trackModifiedFields
* @returns {Boolean} true in case a change was found
*/
isModified(record, trackModifiedFields) {
if (trackModifiedFields) {
return Neo.isEqual(record[dataSymbol], record[initialDataSymbol])
}

return record._isModified
isModified(record) {
return record.isModified
}

/**
Expand Down

0 comments on commit 365be71

Please sign in to comment.