#166 new
Paul Schreiber

Ajax.Autocompleter's getUpdatedChoices can query unnecessarily

Reported by Paul Schreiber | February 5th, 2009 @ 01:40 AM

Ajax.Autocompleter's getUpdatedChoices can query unnecessarily. It does not cache the last query it made, and can ask the server for the same data multiple times.

To avoid this problem, you could do something like this in controls.js:

Autocompleter.Base = Class.create({
  baseInitialize: function(element, update, options) {
    this.lastValueFetched = false;

  getUpdatedChoices: function() {
    if (this.lastValueFetched == this.getToken()) return;
    this.lastValueFetched = this.getToken();

Comments and changes to this ticket

  • justin

    justin April 23rd, 2009 @ 11:18 PM

    • Tag changed from ajax, autocompleter, performance, scriptaculous to ajax, ajax.autocompleter, autocompleter, performance, scriptaculous

    It might be worthwhile here to capture the last Ajax response text and use that if the token hasn't changed but the autocomplete list has been hidden, which when the browser loses and regains focus as identified in #196.

  • Paul Schreiber

    Paul Schreiber April 23rd, 2009 @ 11:50 PM

    The response could potentially be very large. Capturing the whole response could use up a lot of memory.

  • lee young

    lee young October 15th, 2018 @ 12:34 AM

    Welcome from Florida!
    Veterans Day Poems 2018Veterans Day Quotes 2018 I am fatigued to death at the obligation, I immediately resolved to search out your site on my iPhone all through noon break. I like the information you give here and can't hold have a look once I am returning home. I am astonished at how energetically your site stuffed on my phone .. I am not abuse Wi-fi, only 3G. At any rate, decent blog!

  • Pokemon999

    Pokemon999 June 14th, 2019 @ 12:15 PM

    Must be thanks for the nice post getting the windows 10 desktop clock here and seen the batter working to manage time.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
<br/><b>Source available from github</b>
The Git repository resides at:
<a href="http://github.com/madrobby/scriptaculous">http://github.com/madrobby/scriptaculous</a>
<br/>Check out the current development trunk with:
<code>git clone git://github.com/madrobby/scriptaculous.git</code>
<br/>As <b>script.aculo.us 1.xx is feature-frozen</b>, this development trunk is for <b>bugfixes only</b>.
<br/>New development should happen only for
<b>script.aculo.us 2</b>.
<br/><b>Creating a bug report</b>
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, <b>alter the unit tests</b> and show through either changed or added tests how the expected behavior is not occuring.

People watching this ticket

Referenced by