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