[Tooltip] Change detection runs after showing tooltip
- 主要语言
- TypeScript
- 星标
- 25k
- 派生
- 6.8k
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 91
描述
#### 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?
贡献指南
调研方向
从链接的 StackBlitz reproduction 开始,检查在 OnPush 元素上使用 [matTooltip] 绑定其值时 matTooltip 的行为。将其与静态的 matTooltip="..." 情况进行比较,并观察悬停时的 change detection 日志。当 @Input() 值未发生变化时,悬停不会触发不必要的 change detection,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, typescript
- 领域
- frontend, performance
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100