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

matchResponseProperty incorrect asynchronous responses shown #291

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DanHarltey
Copy link

Hi,

I have started using the autocomplete on my new site and I have found a problem where the incorrect results for the entered search term are shown. The matchResponseProperty does not correctly work. The issue can be recreated by making two remote requests for data and having the first request response after the second. For example make two requests for "Tes" and "Test", if "Test" responses first the autocomplete will show the correct results. However when the response for "Tes" arrives after, these results are shown, this is incorrect as the input box contains "Test". This issue particularly affects mobile connections with slow connections.

The error comes about because the inputPhrase is captured before the ajax request and is not reread from the input box on the ajax response. I have replaced this functionality with a simple counter "remoteRequestCount". The counter is captured into a local variable and then rechecked against the state. This also has the befits of not having the users having to include matchResponseProperty in there servers response.

I am sorry but I have only altered the source files. I am an expired developer but not in the javascript world and could not get my grunt build going in the time I had.

Thank you
Dan

…ses where received out of order incorrect results where shown.
@DanHarltey DanHarltey changed the title Removing matchResponseProperty. It contained an issue where if respon… matchResponseProperty incorrect asynchronous responses shown Aug 10, 2017
@fadhilkurnia
Copy link

I am also facing this bug, I think it is better if EasyAutoComplete can cancel previous requests, if another request is created. Just like this library: http://autocomplete-js.com/

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

Successfully merging this pull request may close these issues.

2 participants