question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MudDialog.Show not working for inline MudDialogs

See original GitHub issue

Bug 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

  1. Declare an inline MudDialog and store its reference in a variable
  2. Invoke Show() on said variable
  3. 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:open
  • Created 2 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexMediacommented, May 12, 2022

FYI, this issue is still present in 6.0.10.

1reaction
danheroncommented, Apr 28, 2022

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found