RC Filters: Lazy build menu on model initialization
authorKosta Harlan <kharlan@wikimedia.org>
Sat, 30 Jun 2018 16:30:23 +0000 (12:30 -0400)
committerKosta Harlan <kharlan@wikimedia.org>
Mon, 2 Jul 2018 20:21:22 +0000 (16:21 -0400)
Use setTimeout() on model initialization to build the menu as part of the
page load process to remove the perceptible delay on the first click of the
menu.

Bug: T198535
Change-Id: Icaf0a37444786e80536b680fa37d04d095091377

resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.MenuSelectWidget.js

index 04b7709..40b2fcf 100644 (file)
         */
        mw.rcfilters.ui.MenuSelectWidget.prototype.onModelInitialize = function () {
                this.menuInitialized = false;
+               // Set timeout for the menu to lazy build.
+               setTimeout( this.lazyMenuCreation.bind( this ) );
        };
 
        /**