VadimDez / ngx-order-pipe

▼ Angular 5+ orderBy pipe
https://vadimdez.github.io/ngx-order-pipe/
MIT License
243 stars 57 forks source link

Remove .reverse from multiExpressionTransform #81

Closed k0nG closed 3 years ago

k0nG commented 5 years ago

When using multiple sort keys with a pipe in a *ngFor like ['sortKeyA', 'sortKeyB'], I was seeing a flickering in my HTML view because the sort key order was constantly changing. I identified this was because of the expression.reverse() in multiExpressionTransform.

array.reverse() reverses the array in place. Which means on the next angular check cycle the array is different and then reversed again. Removing the expression.reverse() stops this, removing repeated sorting changing happening in components.

Perhaps the reverse was required? But I can't see a reason for it to be run on every process cycle.

References: [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse]()

VadimDez commented 5 years ago

This PR breaks some of the tests. https://travis-ci.org/VadimDez/ngx-order-pipe/builds/531717911

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.