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

Untrack DialogReference when dialog is closed #2465

Merged
merged 7 commits into from
Feb 27, 2024
Merged
11 changes: 9 additions & 2 deletions src/Aspire.Dashboard/Components/Layout/MainLayout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ private async Task LaunchHelpAsync()
Alignment = HorizontalAlignment.Center,
Width = "700px",
Height = "auto",
Id = HelpDialogId
Id = HelpDialogId,
OnDialogResult = EventCallback.Factory.Create<DialogResult>(this, HandleDialogResult)
};

if (_openPageDialog is not null)
Expand All @@ -117,6 +118,11 @@ private async Task LaunchHelpAsync()
_openPageDialog = await DialogService.ShowDialogAsync<HelpDialog>(parameters).ConfigureAwait(true);
}

private void HandleDialogResult(DialogResult dialogResult)
{
_openPageDialog = null;
}

public async Task LaunchSettingsAsync()
{
DialogParameters parameters = new()
Expand All @@ -130,7 +136,8 @@ public async Task LaunchSettingsAsync()
Alignment = HorizontalAlignment.Right,
Width = "300px",
Height = "auto",
Id = SettingsDialogId
Id = SettingsDialogId,
OnDialogResult = EventCallback.Factory.Create<DialogResult>(this, HandleDialogResult)
};

if (_openPageDialog is not null)
Expand Down