@@ -529,20 +529,22 @@ export function compareOldAndNewRecord(oldRecord: Record<string, any>, newRecord
529529 const coreStore = useCoreStore ( ) ;
530530
531531 for ( const key of newKeys ) {
532- if ( oldRecord [ key ] !== newRecord [ key ] ) {
532+ const oldValue = typeof oldRecord [ key ] === 'object' && oldRecord [ key ] !== null ? JSON . stringify ( oldRecord [ key ] ) : oldRecord [ key ] ;
533+ const newValue = typeof newRecord [ key ] === 'object' && newRecord [ key ] !== null ? JSON . stringify ( newRecord [ key ] ) : newRecord [ key ] ;
534+ if ( oldValue !== newValue ) {
533535 if (
534536 (
535- oldRecord [ key ] === undefined ||
536- oldRecord [ key ] === null ||
537- oldRecord [ key ] === '' ||
538- ( Array . isArray ( oldRecord [ key ] ) && oldRecord [ key ] . length === 0 )
537+ oldValue === undefined ||
538+ oldValue === null ||
539+ oldValue === '' ||
540+ ( Array . isArray ( oldValue ) && oldValue . length === 0 )
539541 )
540542 &&
541543 (
542- newRecord [ key ] === undefined ||
543- newRecord [ key ] === null ||
544- newRecord [ key ] === '' ||
545- ( Array . isArray ( newRecord [ key ] ) && newRecord [ key ] . length === 0 )
544+ newValue === undefined ||
545+ newValue === null ||
546+ newValue === '' ||
547+ ( Array . isArray ( newValue ) && newValue . length === 0 )
546548 )
547549 ) {
548550 // console.log(`Value for key ${key} is considered equal (empty)`)
@@ -556,7 +558,7 @@ export function compareOldAndNewRecord(oldRecord: Record<string, any>, newRecord
556558 continue ;
557559 }
558560 }
559- // console.log(`Value for key ${key} is different`, { oldValue: oldRecord[key] , newValue: newRecord[key] });
561+ // console.log(`Value for key ${key} is different`, { oldValue: oldValue , newValue: newValue });
560562 return false ;
561563 }
562564 }
0 commit comments