Deferred in resolveLatLng is hanging forever if no result in geocoding #103

Closed
intermike opened this Issue Apr 27, 2016 · 2 comments

Projects

None yet

2 participants

@intermike
gmap3.latlng(
    [{address: '50, 50'}]
).then(function (results) {
   // never comes here
}).fail(function () {
   // never comes here
}).always(function () {
   // never comes here
});

Method resolveLatLng creates own deferred object and doesn't process geocode method fail status.

@intermike

I cannot create pull-request by unknown reason - goes to 404.

Anyway here is my change to fix this issue. Adding the following in resolveLatLng method

     .fail(function() {
          dfd.reject();
      })

and result:

  function resolveLatLng(options, key, fn) {
    var dfd = deferred();
    options = dupOpts(options);
    when()
      .then(function () {
        var address = options.address;
        if (address) {
          delete options.address;
          return geocode(address).then(function (latLng) {
            options[key] = latLng;
          });
        }
        options[key] = toLatLng(options[key]);
      })
      .then(function () {
        dfd.resolve(fn(options));
      }).fail(function() {
          dfd.reject();
      });
    return dfd;
  }
@drmuey
drmuey commented Dec 2, 2016

+1 though, even with the new resolveLatLng() I still get the blank grey map w/ no errors in the console :(

@jbdemonte jbdemonte closed this in e1b2aa0 Dec 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment