Refactor PropertyChanges component to maintain model references and special value objects. Update key flattening logic to prevent alteration of specific properties, enhancing data integrity during property change handling.
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
This commit is contained in:
parent
2ff3636913
commit
7ca78280b3
@ -18,11 +18,12 @@ const PropertyChanges = ({ type, value }) => {
|
||||
const val = obj[key]
|
||||
const newKey = prefix ? `${prefix}.${key}` : key
|
||||
|
||||
// Don't flatten keys that are "state" or "netGross"
|
||||
// Keep model references and special value objects intact
|
||||
if (
|
||||
val &&
|
||||
typeof val === 'object' &&
|
||||
!Array.isArray(val) &&
|
||||
!Object.prototype.hasOwnProperty.call(val, '_id') &&
|
||||
key !== 'state' &&
|
||||
key !== 'netGross'
|
||||
) {
|
||||
@ -41,6 +42,9 @@ const PropertyChanges = ({ type, value }) => {
|
||||
...flatOld,
|
||||
...flatNew
|
||||
}
|
||||
|
||||
console.log(combinedChanges)
|
||||
|
||||
return (
|
||||
<Descriptions size='small' column={1}>
|
||||
{Object.keys(combinedChanges).map((key) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user