Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3222 spread custom fields api optimization #3283

Merged
merged 8 commits into from
Aug 31, 2020
Prev Previous commit
Next Next commit
Adapt investments home filters to new API response
  • Loading branch information
entantoencuanto committed Aug 5, 2020
commit 951f5601e4dcac10a365126f2f1887665c365b96
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export default {
this.filters.splice(index, 1, filter); // To detect array mutations

const checkboxFilterFn = attrs =>
attrs[key].find(d => checkboxesSelected.get(+d.id));
attrs[key] && this.convertToArrayOfIds(attrs[key]).find(d => checkboxesSelected.get(+d));

const callback = size ? checkboxFilterFn : undefined;
this.filterItems(callback, key);
Expand Down Expand Up @@ -374,8 +374,9 @@ export default {
// Get the items based on these new active filters
const __items__ = this.applyFiltersCallbacks(__activeFilters__);

return __items__.filter(({ attributes }) =>
attributes[key].map(g => g.id).includes(id)
return __items__.filter(({ attributes }) =>(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may get rid of the wrapping parenthesis, in the filter condition

this.convertToArrayOfIds(attributes[key]).includes(id)
)
).length;
};
const { key, options = [] } = filter;
Expand Down