Skip to content

Commit

Permalink
perf: Clean message if title and detail are equal
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Apr 12, 2022
1 parent b060b16 commit 2ff8cc7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/utils/getAllErrors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const getAllErrors: GetAllErrors = (params) => {
} = params
return allErrors.map((v, k): ReactNode | void => {
const objMsg = customMessages(messages, v)
const text = objMsg?.message || v.message || `${v.title} - ${v.detail}`
const text =
(objMsg?.message || v.message) && v.title !== v.detail
? `${v.title} - ${v.detail}`
: `${v.title}`
if (field) {
if (v.resource === 'line_items') {
if (lineItem && v.id === lineItem['id']) {
Expand Down

0 comments on commit 2ff8cc7

Please sign in to comment.