Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

fix(autocomplete): do not use .then() for $http promise #6860

Closed
wants to merge 1 commit into from
Closed

fix(autocomplete): do not use .then() for $http promise #6860

wants to merge 1 commit into from

Conversation

clementm
Copy link

$http returns promise with both .then() and .success() methods :

currently, autocomplete use both methods, and when handleResults is called from .then(...), items are replaced by http response object

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

1 similar comment
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@clementm
Copy link
Author

I signed it!

@googlebot
Copy link

CLAs look good, thanks!

1 similar comment
@googlebot
Copy link

CLAs look good, thanks!

@ThomasBurleson
Copy link
Contributor

Related and fixed in #6521. Close this PR.

@winniehell
Copy link

I think I don't agree that this is fixed by #6521. In my opinion these are two different issues.

@winniehell
Copy link

This issues is actually what I asked in my comment on de423ae48d593c08f0277376b7e3e80571a3ba48. That commit actually removed $q.when (what @ThomasBurleson suggested to use in #6521) for fixing #1798.

So I support this pull request. 👍

@clementm
Copy link
Author

I double checked the content of both PR and I am pretty sure, as @winniehell says, that both issues are completely different : the problem here is that when using autocomplete with $http promise, we use successively both .success() and .then() methods :

if (items.success) items.success(handleResults);
if (items.then)    items.then(handleResults);

this part of the code is not changed by the PR you mentionned : it lacks an else if statement, making it unusable with $http promise (data is replaced with http response object)

@ThomasBurleson : I didn't say that we should not listen for .success(), it's the opposite : i think whenever .success() is available, we should listen for it instead of .then()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants