You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Option 1: Save this.svgIcon to fetchedSvgIcon before executing getNamedSvgIcon, and check if this.svgIcon === fetchedSvgIcon after getting the result
Option 2: Make this.svgIcon$ (observable of this.svgIcon) and use switchMap
The text was updated successfully, but these errors were encountered:
crisbeto
added
has pr
P3
An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
and removed
needs triage
This issue needs to be triaged by the team
labels
May 10, 2020
crisbeto
added a commit
to crisbeto/material2
that referenced
this issue
May 10, 2020
Currently we can stack up in-flight quests if the icon name changes quickly. These changes will cancel any in-flight requests if that happens or if the icon is destroyed.
Fixesangular#19259.
Reproduction
https://stackblitz.com/edit/components-issue-o5txc8?file=src%2Fapp%2Fexample-component.ts
Steps to reproduce:
Expected Behavior
mat-icon should display "thumbs-up" icon
Actual Behavior
mat-icon is displaying "thumbs-down" icon
Environment
(doesn't really maters..)
Explanation
There is a race-condition when svgIcon is getting a icon that is not already fetched.
Relevant code: https://github.com/angular/components/blob/master/src/material/icon/icon.ts#L229
Possible solutions
Option 1: Save this.svgIcon to fetchedSvgIcon before executing getNamedSvgIcon, and check if this.svgIcon === fetchedSvgIcon after getting the result
Option 2: Make this.svgIcon$ (observable of this.svgIcon) and use switchMap
The text was updated successfully, but these errors were encountered: