refactor(patient/fields): deduplicate religion options using Map
Use Map to ensure unique values in religion options array to prevent duplicate entries in the dropdown
This commit is contained in:
@@ -34,13 +34,17 @@ const extendOptions = [
|
||||
{ label: 'Kepercayaan Lain', value: 'other', priority: -1 },
|
||||
]
|
||||
|
||||
const religionOptions = [
|
||||
...mapToComboboxOptList(religionCodes).map(({ label, value }) => ({
|
||||
label,
|
||||
value,
|
||||
})),
|
||||
...extendOptions,
|
||||
]
|
||||
const religionOptions = Array.from(
|
||||
new Map(
|
||||
[
|
||||
...mapToComboboxOptList(religionCodes).map(({ label, value }) => ({
|
||||
label,
|
||||
value,
|
||||
})),
|
||||
...extendOptions,
|
||||
].map((item) => [item.value, item]),
|
||||
).values(),
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
Reference in New Issue
Block a user