Blazor Web App (InteractiveWebAssembly): Page title flashes to domain name during hydration
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
In a newly created Blazor Web App using the `InteractiveWebAssembly` render mode, the page title briefly flashes to the domain name (e.g., `localhost:port`) during the hydration phase when the WebAssembly app takes over from the server pre-rendered HTML.
Because the browser falls back to the domain name when a `` tag is missing, it appears there is a gap during the `<HeadOutlet>` handoff where the title is completely removed before being re-injected by the WASM client.
This is an issue because it causes web crawlers to save the domain name as page title, affecting SEO. The bigger the page, the more time the hydration process takes, and the more chances Google gets the wrong page title.
### Expected Behavior
The page title defined in `<PageTitle>` should remain persistent during the handoff from server pre-rendering to WebAssembly interactive mode without flashing.
### Steps To Reproduce
- Create a brand new Blazor Web App
- Version: **.NET 10.0**
- Interactive render mode: **WebAssembly**
- Interactivity location: **Global**
- Include sample page
- Run the project
- Refresh the page
- Notice the page title flashing very fast (but not so fast when the page is bigger)
### Exceptions (if any)
_No response_
### .NET Version
10.0.302
### Anything else?
.NET SDK:
Version: 10.0.302
Commit: 35b593bebf
Workload version: 10.0.300-manifests.714b12c0
MSBuild version: 18.6.11+35b593beb
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26200
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\10.0.302\
.NET workloads installed:
[maccatalyst]
Installation Source: VS 18.8.12023.21
Manifest Version: 26.5.10284/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maccatalyst\26.5.10284\WorkloadManifest.json
Install Type: Msi
[ios]
Installation Source: VS 18.8.12023.21
Manifest Version: 26.5.10284/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.ios\26.5.10284\WorkloadManifest.json
Install Type: Msi
[android]
Installation Source: VS 18.8.12023.21
Manifest Version: 36.1.43/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.android\36.1.43\WorkloadManifest.json
Install Type: Msi
[maui-windows]
Installation Source: VS 18.8.12023.21
Manifest Version: 10.0.20/10.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\10.0.100\microsoft.net.sdk.maui\10.0.20\WorkloadManifest.json
Install Type: Msi
Configured to use workload sets when installing new manifests.
No workload sets are installed. Run "dotnet workload restore" to install a workload set.
Host:
Version: 10.0.10
Architecture: x64
Commit: f7d90799ce
.NET SDKs installed:
10.0.302 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.29 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 10.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.29 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 10.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.29 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 10.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
DOTNET_CLI_UI_LANGUAGE [en-US]
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Contributor guide
Assessment
This issue has not been assessed yet.