RC Filters: Check if app is initialized before calling change tags
authorKosta Harlan <kharlan@wikimedia.org>
Thu, 28 Jun 2018 14:22:54 +0000 (10:22 -0400)
committerKosta Harlan <kharlan@wikimedia.org>
Thu, 28 Jun 2018 14:43:51 +0000 (10:43 -0400)
This only occurs when highlighting is enabled in the query parameters on page
load. If you load a watchlist page with highlighting enabled, you'll see that
FilterTagMultiselectWidget calls the parent onChangeTags method, and then we
end up at updateIfHeightChanged where a resize event occurs. This commit
checks to see if the app is still initializing before propagating this event.

Bug: T198399
Change-Id: I8d36875ecf859b40854fe57fecf824e648bb3bf8

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

index 907c535..c7db7c6 100644 (file)
         * @inheritdoc
         */
        mw.rcfilters.ui.FilterTagMultiselectWidget.prototype.onChangeTags = function () {
-               // Parent method
-               mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onChangeTags.call( this );
+               // If initialized, call parent method.
+               if ( this.controller.isInitialized() ) {
+                       mw.rcfilters.ui.FilterTagMultiselectWidget.parent.prototype.onChangeTags.call( this );
+               }
 
                this.emptyFilterMessage.toggle( this.isEmpty() );
        };