diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-01-28 11:22:46 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-01-28 11:27:38 +0000 |
commit | 9ab52402829e01cda1bff1243087a945d272a746 (patch) | |
tree | 3831657c687a4d634a5f6dc130dd0f5ceade5408 /web | |
parent | 2d6af993630d9e43594975e093507ee62ed53b97 (diff) |
Only trigger one change event on initial popstate.
When going back to the initial state with popstate, a change event was
being triggered on every single option of the filter selects. This led
to a lot of change events running on the category/status multi-selects
which then needlessly repeated the same activities over and over. This
locked up the browser for seconds in locations with many categories.
Diffstat (limited to 'web')
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 1a513a1a5..f1e3a1a34 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -1716,9 +1716,9 @@ $(function() { // location.href is something like foo.com/around?pc=abc-123, // which we pass into fixmystreet.display.reports_list() as a fallback // in case the list isn't already in the DOM. - $('#filter_categories').add('#statuses').add('#sort').find('option') - .prop('selected', function() { return this.defaultSelected; }) - .trigger('change.multiselect'); + var filters = $('#filter_categories').add('#statuses').add('#sort'); + filters.find('option').prop('selected', function() { return this.defaultSelected; }); + filters.trigger('change.multiselect'); if (fixmystreet.utils && fixmystreet.utils.parse_query_string) { var qs = fixmystreet.utils.parse_query_string(); var page = qs.p || 1; |