dotnet / dotnet/aspnetcore

Blazor SSR chooses RemoteNavigationManager or HttpNavigationManager unpredictably

Open
#50,260 4 comments 5 reactions 0 assignees View on GitHub
area-blazor bug feature-blazor-ssr Pillar: Complete Blazor Web
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Current behavior:

* If you don't have `AddServerComponents()`, then your SSR components will use `HttpNavigationManager`
* If you do, then both SSR and interactive (server) components will use `RemoteNavigationManager`

Expected:

* Regardless of service registrations, the DI scope for SSR components should use `HttpNavigationManager` while the DI scope for interactive (server) components should use `RemoteNavigationManager`

Or in other words, SSR components currently select between the two implementations based on an entirely unrelated fact (whether or not your app is configured to support interactive server components), which is problematic.

This *shouldn't* currently impact the developer experience or behavior. However it might do, since the two implementations are quite different, and might vary behavior. This was actually the root cause of bug #49670, in the sense that E2E tests said the feature already worked, but that was only true for apps with `AddServerComponents()`.

Longer term we should avoid the risk of inconsistency and similar bugs by ensuring we always use the SSR service for SSR scopes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.