Flip switch for controlling navigation flow on SSR#62358
Flip switch for controlling navigation flow on SSR#62358ilonatommy merged 9 commits intodotnet:mainfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR renames the navigation exception switch and updates its usage across the codebase to support a unified navigation flow for SSR while allowing SSR code to run after navigation. Key changes include renaming the switch from EnableThrowNavigationException to DisableThrowNavigationException, updating test logic with the new inverted parameter, and modifying the navigation manager implementations accordingly.
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/submodules/googletest | Updated subproject commit hash |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/Program.cs | Set the new switch to true for templates |
| src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/Program.Main.cs | Set the new switch to true for templates |
| src/Components/test/E2ETest/ServerRenderingTests/NoInteractivityTest.cs | Inverted switch logic in tests |
| src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs | Inverted switch logic in tests |
| src/Components/Server/src/Circuits/RemoteNavigationManager.cs | Updated constant name and switch logic for remote navigation |
| src/Components/Endpoints/test/EndpointHtmlRendererTest.cs | Inverted switch logic in endpoint tests |
| src/Components/Endpoints/src/DependencyInjection/HttpNavigationManager.cs | Updated constant name and switch logic for HTTP navigation |
javiercn
left a comment
There was a problem hiding this comment.
Looks good once we put the flag in the csproj files and undo the submodule update change!
For dotnet/aspnetcore#62358. Defines a switch that can be controlled by `BlazorDisableThrowNavigationException` property.
|
/backport to release/10.0-preview6 |
|
Started backporting to release/10.0-preview6: https://github.com/dotnet/aspnetcore/actions/runs/15709205261 |
Navigation with
NavigationExceptionstays the default behavior for SSR navigationSwitch was introduced in #61306. The PR unifies the navigation across render modes but also allows SSR code after the navigation to run. Upgrading the application could lead to unexpected behaviors, e.g. see how templates had to be changed to adjust to the new navigation: #62105. From this reason, we decided to keep the default behavior for the exception flow. It can be changed by setting
Microsoft.AspNetCore.Components.Endpoints.NavigationManager.DisableThrowNavigationExceptionswitch. New projects will use the new way of working.Description
This PR:
EnableThrowNavigationException->DisableThrowNavigationException,DisableThrowNavigationException: falseby default,DisableThrowNavigationException: truein the templates.