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
+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