Concurrency issues with find-as-you-type boxes

Updated . Posted . Visible to the public.

Find-as-you-type boxes are usually built by observing changes in a text field, and querying the server via AJAX for search results or suggestions when the field has changed.

A common problem with this implementation is that there is no guarantee that AJAX responses are evaluated in the same order as the original requests. The effect for the user is that the search results are flashing back and forth while the user is typing the query, and when the user has stopped typing the last results don't always match the final query.

Workarounds

Henning Koch
Last edit
Henning Koch
Keywords
live, search, race, condition, serialize, debounce
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2011-01-28 17:36)