Skip to content

Commit fe531e2

Browse files
fix: deduplicate postcode suggestions
Use utilArrayUniqBy to remove duplicates based on value field in getNearPostcodes. Fixes openstreetmap#10845.
1 parent 89af800 commit fe531e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/ui/fields/address.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,10 @@ export function uiFieldAddress(field, context) {
114114
}
115115

116116
function getNearPostcodes() {
117-
return [... new Set([]
117+
const postcodes = []
118118
.concat(getNearValues('postcode'))
119-
.concat(getNear(d => d.tags.postal_code, 'postcode', 200, 'postal_code')))];
119+
.concat(getNear(d => d.tags.postal_code, 'postcode', 200, 'postal_code'));
120+
return utilArrayUniqBy(postcodes, item => item.value);
120121
}
121122

122123
function getNearValues(key) {

0 commit comments

Comments
 (0)