Skip to content

bug(mat-sort-header): performance & change detection issue with the whole table #19441

Closed

Description

@woteska

Reproduction

With Stackblitz I can't reproduce it as dev tools is not working there.

https://ibb.co/XXjZw1r

Steps to reproduce:

  1. Go to official Material page (https://material.angular.io/components/table/overview#sorting)
  2. Press F12
  3. Enable Paint flashing tool
  4. See that if you hover mat-sort-header (not clicking it, just hover), the whole table will be rendered again and again for nothing (even if you leave the sort header).

Expected Behavior

If I have a complex page with Material table, I would not expect performance issues because of re-rendering the whole table on hovering mat-sort-header. Table's data definetely should not connect to mat-sort-header on hover event by default.

Actual Behavior

Causes performance issues.
https://ibb.co/XXjZw1r

Environment

  • Angular: 9 latest
  • CDK/Material: 9 latest
  • Browser(s): Chrome
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows

Activity

  1. added
    needs triage
    on May 25, 2020
  2. changed the title [-]bug([mat-header]): [TITLE][/-] [+]bug(mat-sort-header): performance & change detection issue[/+] on May 25, 2020
  3. changed the title [-]bug(mat-sort-header): performance & change detection issue[/-] [+]bug(mat-sort-header): performance & change detection issue with the whole table[/+] on May 25, 2020
  4. andrewseguin commented on May 26, 2020

    @andrewseguin
    Contributor

    Here is the stackblitz example as a separate site: https://oemlkyybkmp.angular.stackblitz.io/

    If I enable paint flashing, I do not see the entire table flashing green when hovering over the sort headers. Can you confirm that you see the same thing?

  5. added
    needs: clarification
    and removed
    needs triage
    on May 26, 2020
  6. woteska commented on May 30, 2020

    @woteska
    Author

    Here is the stackblitz example as a separate site: https://oemlkyybkmp.angular.stackblitz.io/

    If I enable paint flashing, I do not see the entire table flashing green when hovering over the sort headers. Can you confirm that you see the same thing?

    Unfortunately I can't check it, because it does not load in... "Starting dev server"

  7. wesselvdv commented on Jun 30, 2020

    @wesselvdv

    Isn't this the same as the mat-tooltip issue, where it was ultimately the cdk-overlay that's being re-drawn but because it covers the whole table it appears as if it's the table itself?

  8. added
    needs triage
    and removed
    needs: clarification
    on Aug 13, 2020
  9. crisbeto commented on Aug 16, 2020

    @crisbeto
    Member

    I don't see any paint flashing issues either and as mentioned above, the multiple change detections are because we manage the arrow animations inside the NgZone which fires off several events. We should look into doing something similar to #19432 for the sort header, but I suspect that it'll be more difficult since the animation is more complicated.

  10. added
    P3
    perf
    and removed
    needs triage
    on Aug 16, 2020
  11. AshotAleqs commented on Jan 21, 2021

    @AshotAleqs

    here is the reproductio nexample of this bug:
    https://stackblitz.com/edit/stackoverflow-table-example?file=src%2Fapp%2Ftable-basic-example.html
    I have opened the issue I didn't saw this one.

    #21667

  12. MeMeMax commented on Sep 6, 2022

    @MeMeMax

    Just experienced the same and saw this github issue. This also breaks animations of e.g. charts which destroys the look and feel of my page. A solution is really much appreciated. Ofcourse I know you guys have a lot to do.

  13. added 2 commits that reference this issue on Nov 21, 2024
    6fad88d
    775c7ce
  14. added a commit that references this issue on Nov 27, 2024
    1235ad2
  15. added a commit that references this issue on Nov 27, 2024
    a08eeeb
  16. angular-automatic-lock-bot commented on Dec 28, 2024

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  17. locked and limited conversation to collaborators on Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3area: material/sortperf

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions