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

Clearing input term does not call the action if the same search term is re-entered. #75

Open
bahdvp opened this issue Jul 1, 2019 · 1 comment

Comments

@bahdvp
Copy link

bahdvp commented Jul 1, 2019

Steps to recreate on ember-aupac-typeahead 3.1.x and the following code:

      {{aupac-typeahead
        action=(action (mut searchInput))
        placeholder=placeholder
        allowFreeInput=true
        source=(action "searchAsync")
        async=true
        selection=(readonly searchInput)
      }}
  1. Input "text" into search field
  2. Using another action, clear searchInput (i.e. this.set('searchInput', '');)
  3. Input "text" into search field again
  4. No update occurs.

This issue does not occur if you use a different search term (i.e. "text" followed by "text_")

@bahdvp
Copy link
Author

bahdvp commented Jul 1, 2019

I've just extended the class for now but it looks like this is because of line 253-260 in aupac-typeahead.js: updateSelectionWhenChanged.

When you clear searchInput, oldValue is updated to the first term (in the case above, text). On subsequent updates, oldValue is then equal to value and the action is never sent.

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

1 participant