Skip to content

Commit 5129adc

Browse files
Copilotilonatommy
andcommitted
Wrap OnNavigateTo callback with GetErrorHandledTask for proper exception logging
Co-authored-by: ilonatommy <[email protected]>
1 parent 129d5aa commit 5129adc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ internal async Task InitializeStandardComponentServicesAsync(
8383
IFormCollection? form = null)
8484
{
8585
var navigationManager = httpContext.RequestServices.GetRequiredService<NavigationManager>();
86-
((IHostEnvironmentNavigationManager)navigationManager)?.Initialize(GetContextBaseUri(httpContext.Request), GetFullUri(httpContext.Request), OnNavigateTo);
86+
((IHostEnvironmentNavigationManager)navigationManager)?.Initialize(GetContextBaseUri(httpContext.Request), GetFullUri(httpContext.Request), uri =>
87+
{
88+
_ = GetErrorHandledTask(OnNavigateTo(uri));
89+
return Task.CompletedTask;
90+
});
8791

8892
navigationManager?.OnNotFound += (sender, args) =>
8993
{

0 commit comments

Comments
 (0)