taiga-ui icon indicating copy to clipboard operation
taiga-ui copied to clipboard

🐞 - tuiSortByChange and directionChange methods should not been called together

Open xvs32x opened this issue 1 year ago • 4 comments

Which @taiga-ui/* package(s) are the source of the bug?

addon-table

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ddzbqa

Is this issue blocking you?

Non-Blocking

Description

Hi there, at first, thank you for amazing UI Library. It's the greatest!

In my application router query params and pagination are synced, so query string is a source of truth for the pagination. It looks like when a user change something on the page (sort, direction, etc...), at first, I use router to change the query string, and then, state from query string changes the pagination on a page.

When I try to change the sort column, both of methods (tuiSortByChange and directionChange) try to change query params, but Angular can't handle it. It just skips the second changing, because the previous one hasn't finished yet. Thats why we cant change the sort colum.

I'd like to change the way how it works. For example, use one event instead of two. For instance, it works the same in Angular Material (https://material.angular.io/components/sort/api#MatSort) We have only one event (sortChange) there for both - sort and direction. And it works well with query params.

Thank you!

Angular version

14.0.0

Taiga UI version

3.20.0

Which browsers have you used?

  • [X] Chrome
  • [ ] Firefox
  • [ ] Safari
  • [ ] Edge

Which operating systems have you used?

  • [ ] macOS
  • [X] Windows
  • [ ] Linux
  • [ ] iOS
  • [ ] Android

xvs32x avatar Mar 19 '23 15:03 xvs32x