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

fix: error when submitting consecutive search after submitting search from search suggestion #1332

Merged
merged 1 commit into from
Nov 30, 2022

Conversation

shauke
Copy link
Collaborator

@shauke shauke commented Nov 30, 2022

PR Type

[x] Bugfix

What Is the Current Behavior?

When searching for products with search suggest consecutive searches that have no suggests result in errors or if ther eare suggest the result might not be as expected.

Steps to repeat

  • go to the homepage of your PWA (e.g. https://intershoppwa.azurewebsites.net/)
  • enter a search term that provides search suggestions (e.g. acer)
  • select an entry of the suggested list (e.g. Acer C110)
    image
  • after submitting remove the search term from the search box and enter a different one without selecting (e.g. asus)
    image
  • one can see that the suggested term with the previously selected index is already selected
  • pressing enter after entering the search term would trigger a search for the "selected" suggestion and not for the entered search term (probably not the expected behavior since the selection was not intentionally done)
  • remove the search term again and enter a search term that will not return any suggestions (e.g. something)
  • press enter to submit the search
    • no search is triggered
    • an error is logged in the console "TypeError: se[this.activeIndex] is undefined"
      image

What Is the New Behavior?

The search suggest selection index is reset after each use so that the search behaves as expected.

Does this PR Introduce a Breaking Change?

[x] No

Other Information

AB#81489

@shauke shauke self-assigned this Nov 30, 2022
@shauke shauke added this to the 3.2 milestone Nov 30, 2022
@shauke shauke added the bug Something isn't working label Nov 30, 2022
@shauke shauke merged commit 9d063a9 into develop Nov 30, 2022
@shauke shauke deleted the bugfix/consecutive_search_suggest_error branch November 30, 2022 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant