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
// If there is a dialog that is currently animating open, return the MatDialogRef of that dialog
if (this._dialogAnimatingOpen) {
return this._lastDialogRef;
}
In my case, I use a "loading" component inside a dialog the opens in some situations (generally when a XHR is started) and closed when the response handling is finished. But that handling can involve opening a new dialog, and that is the buggy case I am getting on. In my specific case, there is not XHR, just a Promise that resolves very fast, so my app tries to open a new dialog while the opening animation for the "loading" is not yet finished.
I think that is not a expected behavior return the "opening" dialog ref in that situation. It can wait the animation finish ou simply interrupt it, but not return the previous one.
Reproduction
Steps to reproduce:
Call MatDialog.open(SomeComponent);
Call MatDialog.open(AnotherComponent); in the sequence
Expected Behavior
Returned MatDialogRef returned in the step 1 be different from the returned in the step 2 and, of course, MatDialogRef.componentInstance for the step 1 be different for the returned in the step 2.
Actual Behavior
MatDialogRef and MatDialogRef.componentInstance are the same for the step 1 and 2
Is this a regression?
The previous version in which this bug was not present was
No response
Description
Sometimes when I call MatDialog.open, it returns the previous recently opened dialog instead of opening a new one. I reviewed the source code at https://github.com/angular/components/blob/master/src/material/dialog/dialog.ts and found the culprit:
In my case, I use a "loading" component inside a dialog the opens in some situations (generally when a XHR is started) and closed when the response handling is finished. But that handling can involve opening a new dialog, and that is the buggy case I am getting on. In my specific case, there is not XHR, just a Promise that resolves very fast, so my app tries to open a new dialog while the opening animation for the "loading" is not yet finished.
I think that is not a expected behavior return the "opening" dialog ref in that situation. It can wait the animation finish ou simply interrupt it, but not return the previous one.
Reproduction
Steps to reproduce:
Expected Behavior
Returned MatDialogRef returned in the step 1 be different from the returned in the step 2 and, of course, MatDialogRef.componentInstance for the step 1 be different for the returned in the step 2.
Actual Behavior
MatDialogRef and MatDialogRef.componentInstance are the same for the step 1 and 2
Environment
My angular dependencies:
"@angular/animations": "~13.1.0",
"@angular/cdk": "^13.1.1",
"@angular/common": "~13.1.0",
"@angular/compiler": "~13.1.0",
"@angular/core": "~13.1.0",
"@angular/flex-layout": "^13.0.0-beta.37",
"@angular/forms": "~13.1.0",
"@angular/material": "^13.1.1",
"@angular/material-moment-adapter": "^13.2.0",
"@angular/platform-browser": "~13.1.0",
"@angular/platform-browser-dynamic": "~13.1.0",
"@angular/router": "~13.1.0",
The text was updated successfully, but these errors were encountered: