-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Flip switch for controlling navigation flow on SSR #62358
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
Flip switch for controlling navigation flow on SSR #62358
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
src/Components/Endpoints/src/DependencyInjection/HttpNavigationManager.cs
Outdated
Show resolved
Hide resolved
...jectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Program.Main.cs
Outdated
Show resolved
Hide resolved
src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/BlazorWeb-CSharp/Program.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
NavigationException
stays 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.DisableThrowNavigationException
switch. New projects will use the new way of working.Description
This PR:
EnableThrowNavigationException
->DisableThrowNavigationException
,DisableThrowNavigationException: false
by default,DisableThrowNavigationException: true
in the templates.