[Tooltip] Change detection runs after showing tooltip
- Ngôn ngữ chính
- TypeScript
- Star
- 25k
- Fork
- 6.8k
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 91
Mô tả
#### Bug, feature request, or proposal:
Bug
#### What is the expected behavior?
Hovering an element with a `matTooltip` should not trigger change detection on this element if it is an `OnPush` element and its `@Input()`s does not change.
#### What is the current behavior?
Hovering an element with a `matTooltip` triggers change detection on this element.
This only happens if `matTooltip` is defined using `[matTooltip]="..."` and not when it is defined using `matTooltip="..."`
#### What are the steps to reproduce?
See https://stackblitz.com/edit/angular-material2-issue-ocg9sj
- pass the mouse on the red `div`
- you get logs everytime the function needed to draw the component are called
- you don't get any log from `ngOnChanges`
- I would expect that since the `@Input()` didn't change, the component shouldn't be redraw!
#### What is the use-case or motivation for changing an existing behavior?
Prevent useless redraws
#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
cf stackblitz
#### Is there anything else we should know?
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với bản reproduction StackBlitz được liên kết và kiểm tra hành vi của matTooltip khi giá trị của nó được bind bằng [matTooltip] trên một phần tử OnPush. So sánh với trường hợp matTooltip="..." tĩnh và quan sát các log change detection khi di chuột qua. Hoàn tất nghĩa là thao tác di chuột qua không kích hoạt change detection không cần thiết khi các giá trị @Input() không thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- angular, typescript
- Lĩnh vực
- frontend, performance
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 42/100