Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/124827

Change subject: jquery.suggestions: Debounce calls to $.suggestions.special
......................................................................

jquery.suggestions: Debounce calls to $.suggestions.special

The custom calls used there can be comparatively expensive and it
might not be a good idea to redo them on every keystroke.

Bug: 59172
Change-Id: I0cdf53eec798a714825c94d80f100b5cf5841f5d
---
M resources/src/jquery/jquery.suggestions.js
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/27/124827/1

diff --git a/resources/src/jquery/jquery.suggestions.js 
b/resources/src/jquery/jquery.suggestions.js
index 0c89b73..28c4731 100644
--- a/resources/src/jquery/jquery.suggestions.js
+++ b/resources/src/jquery/jquery.suggestions.js
@@ -89,9 +89,9 @@
         * @param {Boolean} delayed Whether or not to delay this by the 
currently configured amount of time
         */
        update: function ( context, delayed ) {
-               // Only fetch if the value in the textbox changed and is not 
empty, or if the results were hidden
-               // if the textbox is empty then clear the result div, but leave 
other settings intouched
                function maybeFetch() {
+                       // Only fetch if the value in the textbox changed and 
is not empty, or if the results were hidden
+                       // if the textbox is empty then clear the result div, 
but leave other settings intouched
                        if ( context.data.$textbox.val().length === 0 ) {
                                $.suggestions.hide( context );
                                context.data.prevText = '';
@@ -104,6 +104,9 @@
                                        context.config.fetch.call( 
context.data.$textbox, context.data.$textbox.val() );
                                }
                        }
+
+                       // Always update special rendering
+                       $.suggestions.special( context );
                }
 
                // Cancels any delayed maybeFetch call, and invokes 
context.config.cancel.
@@ -116,7 +119,6 @@
                } else {
                        maybeFetch();
                }
-               $.suggestions.special( context );
        },
 
        special: function ( context ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/124827
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cdf53eec798a714825c94d80f100b5cf5841f5d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to