angular / angular/components

[Tooltip] Change detection runs after showing tooltip

Ouverte
#10,306 33 commentaires 81 réactions 0 personnes assignées Voir sur GitHub
area: material/tooltip P3
Langage dominant
TypeScript
Étoiles
25k
Forks
6.8k
Merge moyen
1 j 8 h
PR mergées (30 j)
91

Description

#### 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?

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par la reproduction StackBlitz liée et examinez le comportement de matTooltip lorsque sa valeur est liée avec [matTooltip] sur un élément OnPush. Comparez-le au cas statique matTooltip="..." et observez les journaux de Change Detection lors du survol. C’est terminé lorsque le survol ne déclenche pas de Change Detection inutile si les valeurs de @Input() n’ont pas changé.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
frontend, performance
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.