New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
2 participants
@intermike

intermike commented Apr 27, 2016

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

This comment has been minimized.

Show comment
Hide comment
@intermike

intermike Apr 27, 2016

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;
  }

intermike commented Apr 27, 2016

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

This comment has been minimized.

Show comment
Hide comment
@drmuey

drmuey Dec 2, 2016

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

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