diff --git a/src/components/Dashboard/common/PropertyChanges.jsx b/src/components/Dashboard/common/PropertyChanges.jsx index 61eaa03..8b342ce 100644 --- a/src/components/Dashboard/common/PropertyChanges.jsx +++ b/src/components/Dashboard/common/PropertyChanges.jsx @@ -8,7 +8,7 @@ import ArrowRightIcon from '../../Icons/ArrowRightIcon' const { Text } = Typography const PropertyChanges = ({ type, value }) => { - if (!value || !value.new) { + if (!value || (!value.new && !value.old)) { return n/a } @@ -18,7 +18,15 @@ const PropertyChanges = ({ type, value }) => { if (Object.prototype.hasOwnProperty.call(obj, key)) { const val = obj[key] const newKey = prefix ? `${prefix}.${key}` : key - if (val && typeof val === 'object' && !Array.isArray(val)) { + + // Don't flatten keys that are "state" or "netGross" + if ( + val && + typeof val === 'object' && + !Array.isArray(val) && + key !== 'state' && + key !== 'netGross' + ) { flattenObject(val, newKey, res) } else { res[newKey] = val @@ -34,7 +42,6 @@ const PropertyChanges = ({ type, value }) => { ...flatOld, ...flatNew } - console.log('combined', combinedChanges) return ( {Object.keys(combinedChanges).map((key) => { @@ -46,19 +53,25 @@ const PropertyChanges = ({ type, value }) => { return ( - - - - - + {value?.old ? ( + + ) : null} + {value?.old && value?.new ? ( + + + + ) : null} + {value?.new ? ( + + ) : null} )