1- import Base from '../core/Base.mjs' ;
2- import Logger from '../util/Logger.mjs' ;
3- import Model from './Model.mjs' ;
1+ import Base from '../core/Base.mjs' ;
2+ import Model from './Model.mjs' ;
43
54const
65 dataSymbol = Symbol . for ( 'data' ) ,
@@ -166,15 +165,10 @@ class RecordFactory extends Base {
166165 isModifiedField ( fieldName ) {
167166 let me = this ;
168167
169- // Check if the field getter does exist
170- if ( ! Object . hasOwn ( me . __proto__ , fieldName ) ) {
171- Logger . logError ( 'The record does not contain the field' , fieldName , me )
172- }
173-
174168 if ( model . trackModifiedFields ) {
175169 let dataScope , originalDataScope ;
176170
177- if ( model . hasNestedFields && fieldName . includes ( '.' ) ) {
171+ if ( model . hasNestedFields && fieldName ? .includes ( '.' ) ) {
178172 let nsArray = fieldName . split ( '.' ) ;
179173
180174 fieldName = nsArray . pop ( ) ;
@@ -185,6 +179,14 @@ class RecordFactory extends Base {
185179 originalDataScope = me [ originalDataSymbol ]
186180 }
187181
182+ // Check if the field exists
183+ if (
184+ ! model . getField ( fieldName ) && // Check for leaf fields (could be excluded inside the real data)
185+ ! Object . hasOwn ( dataScope , fieldName ) // Check the data tree
186+ ) {
187+ console . error ( 'The record does not contain the field' , fieldName , me )
188+ }
189+
188190 return ! Neo . isEqual ( dataScope [ fieldName ] , originalDataScope [ fieldName ] )
189191 }
190192
0 commit comments