-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(autocomplete): stop loading if last promise got resolved #6927
fix(autocomplete): stop loading if last promise got resolved #6927
Conversation
@robertmesserle - please review/test/authorize. |
8a0971f
to
5332162
Compare
promiseFetch = false; | ||
if (--fetchesInProgress === 0) { | ||
setLoading(false); | ||
promiseFetch = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be cleaner to have only one variable that tracks the fetching state. I'd get rid of promiseFetch and just use fetchesInProgress. If need be, add a getter method that just returns fetchesInProgress === 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes definitely 👍 Just had no chance to look over, because of the rebased 52a519e commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kseamon Just want to let you know 😄 - Done!
5332162
to
14026f1
Compare
@ThomasBurleson LGTM |
14026f1
to
f168ccb
Compare
Rebased for 4d59a61 |
> Just investigated a bit, the problem is, the autocomplete will set the loading state to false if a previous promise is resolved. So when you search for A-R-I-Z-O-N-A (normally typed - not pasted) there will be a promise for each char. So the state of setLoading will change to false. This can be solved by adding a simple fetching queue. But only check the queue on the promise finally to store the retrieved results in cache. Fixes angular#6907
f168ccb
to
6feafc1
Compare
> Just investigated a bit, the problem is, the autocomplete will set the loading state to false if a previous promise is resolved. So when you search for A-R-I-Z-O-N-A (normally typed - not pasted) there will be a promise for each char. So the state of setLoading will change to false. This can be solved by adding a simple fetching queue. But only check the queue on the promise finally to store the retrieved results in cache. Fixes #6907 Closes #6927 # Conflicts: # src/components/autocomplete/js/autocompleteController.js
> Just investigated a bit, the problem is, the autocomplete will set the loading state to false if a previous promise is resolved. So when you search for A-R-I-Z-O-N-A (normally typed - not pasted) there will be a promise for each char. So the state of setLoading will change to false. This can be solved by adding a simple fetching queue. But only check the queue on the promise finally to store the retrieved results in cache. Fixes #6907 Closes #6927 # Conflicts: # src/components/autocomplete/js/autocompleteController.js
> Just investigated a bit, the problem is, the autocomplete will set the loading state to false if a previous promise is resolved. So when you search for A-R-I-Z-O-N-A (normally typed - not pasted) there will be a promise for each char. So the state of setLoading will change to false. This can be solved by adding a simple fetching queue. But only check the queue on the promise finally to store the retrieved results in cache. Fixes angular#6907 Closes angular#6927
As said in #6907:
-- Little notice.
Fixes #6907