onSelect item should trigger store.pendingRequests.cancelAll();
AntoineDuComptoirDesPharmacies opened this issue · 1 comments
AntoineDuComptoirDesPharmacies commented
Description
Following of this issue : #806, when we programatically call setIsOpen(false)
to the Autocomplete
instance, the current requests are not cancelled and the panel re-open when queries finish.
Reproduction
Steps
- Go to the code sandbox
- Click on the Search and type 'd', wait for results to display
- Pass your browser network in slow mode
- Type 'deb' in the search bar and immediately select an item from the previous search (that will trigger a
setIsOpen(false)
+history.push
to bring you to the item subpage) - React router change the components of the user, the search is correctly closed
- As requests are not cancelled, when one finish, the autocomplete panel re-open
Expected behavior
When the autocomplete isOpen
become false, all existing queries should be cancelled so the autocomplete panel re-open only if the input take focus again.
Environment
- OS: Windows 10
- Browser: Chrome
- Autocomplete version: 1.11.1
Haroenv commented
I believe that redirects may rely on the request not being cancelled (at least available in the results), but it should indeed prevent to reopen though