Skip to content

Commit

Permalink
Merge pull request #79 from renato/main
Browse files Browse the repository at this point in the history
FIX: location search debounce
  • Loading branch information
angusmcleod committed May 9, 2023
2 parents 82c446a + 5772bd1 commit 5358bf5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
Expand Up @@ -9,11 +9,6 @@ export default TextField.extend({
classNames: 'location-selector',
context: null,

settings() {
const rootElement = getOwner(this).get('rootElement');
return rootElement === '#custom-wizard-main' ? Wizard.SiteSettings : this.siteSettings;
},

didInsertElement() {
this._super();
let self = this;
Expand Down Expand Up @@ -45,8 +40,8 @@ export default TextField.extend({

self.set('loading', true);

return geoLocationSearch(request, self.get('settings.location_geocoding_debounce')).then((result) => {
const defaultProvider = self.get('settings.location_geocoding_provider');
return geoLocationSearch(request, self.siteSettings.location_geocoding_debounce).then((result) => {
const defaultProvider = self.siteSettings.location_geocoding_provider;
const geoAttrs = self.get('geoAttrs');
const showType = self.get('showType');
let locations = [];
Expand Down
16 changes: 8 additions & 8 deletions assets/javascripts/discourse/lib/location-utilities.js.es6
Expand Up @@ -29,14 +29,14 @@ let geoLocationSearch = (request, location_geocoding_debounce) => {
return new Promise(function (resolve, reject) {
debounce(
this,
function () {
locationSearch(request, function (r) {
if (r.error) {
reject(r.message);
} else {
resolve(r);
}
});
locationSearch,
request,
function (r) {
if (r.error) {
reject(r.message);
} else {
resolve(r);
}
},
location_geocoding_debounce
);
Expand Down

0 comments on commit 5358bf5

Please sign in to comment.