RC Filters: Avoid unnecessary update events when clearing highlight
authorKosta Harlan <kosta@fastmail.com>
Fri, 29 Jun 2018 18:58:03 +0000 (14:58 -0400)
committerGergő Tisza <gtisza@wikimedia.org>
Mon, 2 Jul 2018 16:23:46 +0000 (16:23 +0000)
commit830efff4fc1cade606eecdaa1f7f78e0dc5e1226
tree761a98f19959ec15047ec62bf9c7fb220252c960
parenta98e6808ee9a980466700d7b49168d90403938c7
RC Filters: Avoid unnecessary update events when clearing highlight

The strict equality check just below the lines added in this commit will fail
if the Item's highlightColor is null/undefined, and if the incoming parameter
is null. This situation happens when
mw.rcfilters.dm.ItemModel.prototype.clearHighlightColor is called when updating
the state from the query parameters. By returning early we can avoid emitting
update events for every filter item.

Bug: T198359
Change-Id: Ia3e5f333964545c7f33777be915389728c03eace
resources/src/mediawiki.rcfilters/dm/mw.rcfilters.dm.ItemModel.js