[Tooltip] Change detection runs after showing tooltip
- Lingua principale
- TypeScript
- Stelle
- 25k
- Fork
- 6.8k
- Merge medio
- 1g 8h
- PR unite (30g)
- 91
Descrizione
#### 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?
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con la riproduzione StackBlitz collegata e analizza il comportamento di matTooltip quando il suo valore è associato con [matTooltip] su un elemento OnPush. Confrontalo con il caso statico matTooltip="..." e osserva i log di change detection durante il passaggio del mouse. Il lavoro è completato quando il passaggio del mouse non attiva una change detection non necessaria se i valori di @Input() non sono cambiati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- angular, typescript
- Ambito
- frontend, performance
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100