Skip to content

Commit

Permalink
fix(de form async validation): prevent other field validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammer5 committed Oct 30, 2023
1 parent a3a4135 commit bb839b2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/pages/dataElements/form/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export function NameField() {
helpText={i18n.t(
'A data element name should be concise and easy to recognize.'
)}
validate={checkIsValueTaken}
// Do not pass checkIsValueTaken directly, otherwise memoization
// won't work due to additional arguments being passed
validate={(name: string) => checkIsValueTaken(name)}
validateFields={[]}
/>
)
}
Expand All @@ -70,7 +73,10 @@ export function ShortNameField() {
})}
name="shortName"
helpText={i18n.t('Often used in reports where space is limited')}
validate={checkIsValueTaken}
// Do not pass checkIsValueTaken directly, otherwise memoization
// won't work due to additional arguments being passed
validate={(shortName: string) => checkIsValueTaken(shortName)}
validateFields={[]}
/>
)
}
Expand Down

0 comments on commit bb839b2

Please sign in to comment.