make a copy of filters before checking isEqual

- to prevent using same pointer
This commit is contained in:
Deep Tailor 2020-03-25 11:11:17 -07:00
parent 459b2060a5
commit ca022b8a28

View File

@ -377,8 +377,11 @@ define([
* @public * @public
*/ */
updateFiltersAndRefresh: function (updatedFilters) { updateFiltersAndRefresh: function (updatedFilters) {
if (this.filters && !_.isEqual(this.filters, updatedFilters)) { let deepCopiedFilters = JSON.parse(JSON.stringify(updatedFilters));
this.filters = updatedFilters;
if (this.filters && !_.isEqual(this.filters, deepCopiedFilters)) {
console.log('actually updating');
this.filters = deepCopiedFilters;
this.reset(); this.reset();
if (this.unsubscribe) { if (this.unsubscribe) {
this.unsubscribe(); this.unsubscribe();
@ -386,7 +389,7 @@ define([
} }
this.fetch(); this.fetch();
} else { } else {
this.filters = updatedFilters; this.filters = deepCopiedFilters;
} }
} }
}); });