MudDialog.Show not working for inline MudDialogs
See original GitHub issueBug type
Component
Component name
MudDialog
What happened?
In my project, I use inlined MudDialogs in a couple of places. I use these to provide user input. As they’re highly specific to the page they’re used in, I’ve inlined these dialogs.
In MudBlazor 6.0.2 this works as expected. I’m now trying to upgrade to MB6.0.7, and found out that the functionality no longer works as it did before.
Expected behavior
Similar behaviour as how it worked in MudBlazor 6.0.2, or when using DialogService.Show<T>().
Reproduction link
https://try.mudblazor.com/snippet/wEQcOHEHTrPPKude
Reproduction steps
- Declare an inline MudDialog and store its reference in a variable
- Invoke
Show()
on said variable - Observe the dialog not showing, the task being returned by IDialogReference.Result having ran to completion, and its value being
null
Relevant log output
No response
Version (bug)
6.0.7
Version (working)
6.0.2
What browsers are you seeing the problem on?
Microsoft Edge
On what operating system are you experiencing the issue?
Windows
Pull Request
- I would like to do a Pull Request
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:17 (4 by maintainers)
Top Results From Across the Web
Inline MudDialog always visible when used inside another ...
When I use an inline MudDialog inside a MudDialog (which is opened with DialogService), the inline dialog is always visible.
Read more >Dialog
You can inline a MudDialog within another MudDialog , even in another inline dialog. This example shows both ways of nesting an inline...
Read more >Creating A Confirmation Modal With Blazor + MudBlazor
In this file, we need to use MudDialog for the general structure, DialogContent to specify the confirmation message, and DialogActions to ...
Read more >Blazor Material Form Creation with File Upload and Dialogs
Using a Blazor Material Form component alongside with the Dialog, Upload and Snackbar compnents to create a new form and validation.
Read more >Blast Off with Blazor: Add a shared dialog component
After some simple Tailwind CSS styling, I'm using ImageDetails properties to populate my dialog. <MudDialog> <DialogContent> <MudContainer ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI, this issue is still present in 6.0.10.
@horaciodiez: I have been experiencing the same problem as you - sometimes the dialog won’t close, but sometimes it does. (Although I don’t think this is the same problem that the OP has).
I traced the problem and found that it is because I have multiple Layouts in my app. I have <MudDialogProvider/> in MainLayout.razor as per the ‘Getting Started’ page in the docs. This means that when I am moving between pages that use MainLayout and other Layouts that the MudDialogProvider gets created multiple times.
This shouldn’t be a problem. However the MudDialogProvider is not Disposed correctly. The event handlers for OnDialogInstanceAdded and OnDialogCloseRequested are not being removed in the Dispose method like they should be. This causes a problem in the DismissInstance method and the dialog is not closed.
As a workaround I have moved <MudDialogProvider/> to App.razor. This means that only one instance of MudDialogProvider is ever created.
Edit: Created a new issue as this is not the same as the OP’s problem. New issue is #4508.