Merge "RCFilters: Don't apply/clear highlights 66 times"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 30 Sep 2017 02:09:46 +0000 (02:09 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 30 Sep 2017 02:09:46 +0000 (02:09 +0000)
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.FiltersViewModel.js

index 3b882a6..fdea5ef 100644 (file)
                enable = enable === undefined ? !this.highlightEnabled : enable;
 
                if ( this.highlightEnabled !== enable ) {
-                       this.highlightEnabled = enable;
-
+                       // HACK make sure highlights are disabled globally while we toggle on the items,
+                       // otherwise we'll call clearHighlight() and applyHighlight() many many times
+                       this.highlightEnabled = false;
                        this.getItems().forEach( function ( filterItem ) {
                                filterItem.toggleHighlight( this.highlightEnabled );
                        }.bind( this ) );
 
+                       this.highlightEnabled = enable;
                        this.emit( 'highlightChange', this.highlightEnabled );
                }
        };