fix leaking of localized strings in combo fields when taginfo is unavailable

fixes #9342

and fall back to populate such fields with "static" options if taginfo service is offline
This commit is contained in:
Martin Raifer
2022-10-25 16:30:26 +02:00
parent cb1202883f
commit e8b0c5c7cd
2 changed files with 8 additions and 2 deletions
+2
View File
@@ -45,6 +45,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
#### :white_check_mark: Validation
#### :bug: Bugfixes
* Fix selection of best background source when starting on a zoomed-out view ([#9325])
* Fix leaking of localized strings in combo fields when taginfo service is unavailable ([#9342])
#### :rocket: Presets
* Support tagging schema v5 ([#9320]):
* Add new field type `colour` ([schema-builder#38], [#8782])
@@ -57,6 +58,7 @@ _Breaking developer changes, which may affect downstream projects or sites that
[#9294]: https://github.com/openstreetmap/iD/issues/9294
[#9320]: https://github.com/openstreetmap/iD/pull/9320
[#9325]: https://github.com/openstreetmap/iD/issues/9325
[#9342]: https://github.com/openstreetmap/iD/issues/9342
[schema-builder#38]: https://github.com/ideditor/schema-builder/pull/38
# 2.22.0
+6 -2
View File
@@ -141,8 +141,8 @@ export function uiFieldCombo(field, context) {
if (_showTagInfoSuggestions && services.taginfo) {
selection.call(_combobox.fetcher(setTaginfoValues), attachTo);
setStaticValues(); // pre-populate _combobox.data with static values
setTaginfoValues('', setPlaceholder);
} else {
selection.call(_combobox, attachTo);
setStaticValues(setPlaceholder);
@@ -189,7 +189,11 @@ export function uiFieldCombo(field, context) {
}
services.taginfo[fn](params, function(err, data) {
if (err) return;
if (err) {
// if service is unavailable: use static values (if any)
setStaticValues(callback);
return;
}
data = data.filter(function(d) {
// don't show the fallback value