Skip to content
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

onSelect item should trigger store.pendingRequests.cancelAll(); #1207

Open
AntoineDuComptoirDesPharmacies opened this issue Oct 17, 2023 · 1 comment

Comments

@AntoineDuComptoirDesPharmacies

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

Preview →

Steps

  1. Go to the code sandbox
  2. Click on the Search and type 'd', wait for results to display
  3. Pass your browser network in slow mode
  4. 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)
  5. React router change the components of the user, the search is correctly closed
  6. 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
Copy link
Contributor

Haroenv commented Oct 18, 2023

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

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

No branches or pull requests

2 participants