Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug(Dialog): @Inject(MAT_DIALOG_DATA) reference is not getting data in Micro Frontend Architecture #29286

Closed
1 task
goyalsunil452 opened this issue Jun 20, 2024 · 3 comments
Labels
area: material/dialog needs: clarification The issue does not contain enough information for the team to determine if it is a real bug

Comments

@goyalsunil452
Copy link

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When using Angular's MatDialog in a micro frontend architecture, the @Inject(MAT_DIALOG_DATA) reference is receiving an empty object instead of the expected data. Additionally, dialog.closeAll and other dialog-related functions are not working as expected.

Reproduction

Architecture:

MFE-APP1
app1.component using common-dialog-component (imported common-dialog-comp module in app1.module)
MFE-APP2
app2.component using common-dialog-component (imported common-dialog-comp module in app2.module)
Library1
common-dialog-component (has its own module)
All dependencies related to MatDialog are correctly imported in the respective modules.

Context:

Angular Micro Frontend Architecture
Separate applications and shared libraries for common components
MatDialog used to open a component from a shared library
Data passed correctly when the component is used directly within the application
Reproduction Steps:

In the application component, open a dialog with the following code:
typescript
Copy code
let ref = this.dialogService.open(FileUploadPreviewComponent, {
data: data,
panelClass: 'file-upload-preview-dialog',
});
FileUploadPreviewComponent is a component from the shared library where @Inject(MAT_DIALOG_DATA) is used:
typescript
Copy code
constructor(@Inject(MAT_DIALOG_DATA) public data: any) {}
Notice that the data object is empty in the FileUploadPreviewComponent.

Expected Behavior

The data object should contain the data passed to the dialog.
Functions like dialog.closeAll should work as expected

Actual Behavior

The data object is empty in the FileUploadPreviewComponent.
dialog.closeAll and other dialog-related functions are not working

Environment

  • Angular: 12.2.16
  • CDK/Material: 12.2.13
  • Browser(s): Chrome (Version 126.0.6478.114 (Official Build) (64-bit))
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows
@goyalsunil452 goyalsunil452 added the needs triage This issue needs to be triaged by the team label Jun 20, 2024
@crisbeto
Copy link
Member

It looks like you're using an old version of Angular and Material. Have you tried updating to the latest?

@crisbeto crisbeto added needs: clarification The issue does not contain enough information for the team to determine if it is a real bug area: material/dialog and removed needs triage This issue needs to be triaged by the team labels Jun 20, 2024
@mmalerba
Copy link
Contributor

mmalerba commented Aug 6, 2024

Closing due to inactivity

@mmalerba mmalerba closed this as completed Aug 6, 2024
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: material/dialog needs: clarification The issue does not contain enough information for the team to determine if it is a real bug
Projects
None yet
Development

No branches or pull requests

3 participants