[Tooltip] Change detection runs after showing tooltip
- Vorherrschende Sprache
- TypeScript
- Sterne
- 25k
- Forks
- 6.8k
- Ø Merge
- 1 T. 8 Std.
- Gemergte PRs (30 T.)
- 91
Beschreibung
#### 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?
Beitragsleitfaden
Rechercherichtung
Beginne mit der verlinkten StackBlitz-Reproduktion und untersuche das Verhalten von matTooltip, wenn sein Wert mit [matTooltip] an ein OnPush-Element gebunden ist. Vergleiche es mit dem statischen Fall matTooltip="..." und beobachte die Change-Detection-Logs beim Hover. Erledigt bedeutet, dass Hovering keine unnötige Change Detection auslöst, wenn sich die @Input()-Werte nicht geändert haben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- angular, typescript
- Bereich
- frontend, performance
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 42/100