Skip to content

Commit

Permalink
Merge pull request #282 from siemens/feat/mr/proposed_changes
Browse files Browse the repository at this point in the history
fix(MR): Fixed error handling in current and suggested value under proposed changes
  • Loading branch information
hoangnt2 committed Jun 19, 2024
2 parents e4ca205 + 21c9717 commit 8b67b53
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function ProposedChanges({ moderationRequestData }:
name: t('Current Value'),
sort: true,
formatter: ([currentValue, isObject]: [currentValue: string[], isObject: boolean]) =>
_( isObject === true ? (currentValue.map((item: string) =>
_( isObject === true && currentValue.length !== 0 ? (currentValue.map((item: string) =>
<>
{<li>{`${item}`}</li>}
</>
Expand All @@ -75,7 +75,7 @@ export default function ProposedChanges({ moderationRequestData }:
name: t('Suggested Value'),
sort: true,
formatter: ([suggestedValue, isObject]: [suggestedValue: string[], isObject: boolean]) =>
_( isObject === true ? (suggestedValue.map((item: string) =>
_( isObject === true && suggestedValue.length !== 0 ? (suggestedValue.map((item: string) =>
<>
{<li>{`${item}`}</li>}
</>
Expand Down Expand Up @@ -127,9 +127,9 @@ export default function ProposedChanges({ moderationRequestData }:
isObject = true
for (const k in documentAdditions[key]) {
changedData.push([ `${key}[${k}]:`,
((interimData as interimDataType)[key] != null &&
(Object.keys((interimData as interimDataType)[key]).length !== 0 &&
(interimData as interimDataType)[key][k]) ?
[(interimData as interimDataType)[key][k], isObject] : ['', isObject],
[(interimData as interimDataType)[key][k], isObject] : [[], isObject],
t('n a modified list'),
[documentAdditions[key][k], isObject]])
}
Expand All @@ -145,9 +145,9 @@ export default function ProposedChanges({ moderationRequestData }:
return !(item[k] === (interimData as interimDataType)[key][k])
})
changedData.push([ `${key}[${k}]:`,
((interimData as interimDataType)[key] != null &&
(Object.keys((interimData as interimDataType)[key]).length !== 0 &&
(interimData as interimDataType)[key][k]) ?
[(interimData as interimDataType)[key][k], isObject] : ['', isObject],
[(interimData as interimDataType)[key][k], isObject] : [[], isObject],
t('n a modified list'),
[filteredData[k]], isObject])
}}
Expand All @@ -173,8 +173,7 @@ export default function ProposedChanges({ moderationRequestData }:
[documentAdditions[key], isObject]])
}
}}

setProposedBasicChangesData(changedData)
setProposedBasicChangesData(changedData)
}

useEffect(() => {
Expand Down

0 comments on commit 8b67b53

Please sign in to comment.