mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-27 07:53:40 +00:00
Prevent stale results when first searching presets
This commit is contained in:
@@ -105,16 +105,21 @@ export function uiPresetList(context) {
|
||||
if (geocoder && entity) {
|
||||
var center = entity.extent(context.graph()).center();
|
||||
geocoder.countryCode(center, function countryCallback(err, countryCode) {
|
||||
// get the input value again because it may have changed
|
||||
var currentValue = search.property('value');
|
||||
|
||||
if (!currentValue.length) return;
|
||||
|
||||
var results;
|
||||
if (!err && countryCode) {
|
||||
countryCode = countryCode.toLowerCase();
|
||||
results = presets.search(value, geometry, countryCode);
|
||||
results = presets.search(currentValue, geometry, countryCode);
|
||||
} else {
|
||||
results = presets.search(value, geometry);
|
||||
results = presets.search(currentValue, geometry);
|
||||
}
|
||||
message.text(t('inspector.results', {
|
||||
n: results.collection.length,
|
||||
search: value
|
||||
search: currentValue
|
||||
}));
|
||||
list.call(drawList, results);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user