Repository navigation
Closed
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
When a Blazor Web App component uses @rendermode InteractiveWebAssembly with [PersistentState(AllowUpdates = true)], enhanced navigation ignores the persisted snapshot. Navigating back to the page causes the WASM instance to rerun OnInitializedAsync, regenerate data, and overwrite the server-provided value—even though the initial hydration works. Full reloads (forceLoad: true) or @rendermode InteractiveServer preserve state correctly.
To Reproduce
git clone https://github.com/CoCoNuTeK/-PersistentState-AllowUpdates-true-issue-when-InteractiveWebAssembly.git
cd -PersistentState-AllowUpdates-true-issue-when-InteractiveWebAssembly/PersistenceStateIssue
dotnet run- Open
http://localhost:5041/persist-demo-bin Chrome with DevTools open. - Observe initial console output, for example:
[PersistDemoB] Skipping random value generation because state already contains '39'. [PersistDemoA] No persisted random value found. Simulating load before generating a new value. [PersistDemoA] Generated random value '72'. [PersistDemoB] No persisted random value found. Simulating load before generating a new value. [PersistDemoB] Generated random value '25'. - Use the on-page buttons (which call
NavigateTo(..., forceLoad: false)) to switch between/persist-demo-aand/persist-demo-b. - Each enhanced navigation triggers another execution of
OnInitializedAsyncin the WASM instance and generates a new random value, despite the Network tab showing the prerender and[PersistentState(AllowUpdates = true)]being present. - Setting
forceLoad: trueavoids the issue but removes enhanced navigation.
Exceptions (if any)
None.
Further technical details
details of dotnet --info
.NET SDK (reflecting any global.json):
Version: 10.0.100-rc.1.24452.12 (arm64)
OS Name: macOS
OS Version: 14.xx (Sonoma)
RID: osx-arm64
- IDE: Visual Studio Code Version:
1.104.3
Commit: 385651c938df8a906869babee516bffd0ddb9829
Date: 2025-10-02T12:30:51.747Z
Electron: 37.3.1
ElectronBuildId: 12404162
Chromium: 138.0.7204.235
Node.js: 22.18.0
V8: 13.8.258.31-electron.0
OS: Darwin arm64 24.6.0
Repro repository: https://github.com/CoCoNuTeK/-PersistentState-AllowUpdates-true-issue-when-InteractiveWebAssembly
Steps To Reproduce
in repo README.md
Exceptions (if any)
None
.NET Version
.NET SDK: 10.0.0-rc.1 (arm64 build)
Reacted by Brendan Ridenour
Activity
MihuBot commentedon Oct 10, 2025
I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):
SimSef commentedon Oct 10, 2025
Similar issue but the Pre- render happens on each enhanced nav to InteractiveWebAssembly. And the issue is that the hydration works only on full page reload (when navigating to InteractiveWebAssembly page it correctly takes the pre-rendered data and carries it over to hydration) but on enhanced nav it pre-renders (which given the docs shouldnt be the case) but then also it doesnt carry it over to the hydration state. Meaning 2 issues occur at the same time.
javiercn commentedon Aug 13, 2026
This was fixed by #68088, which corrected persisted-state discovery when enhanced navigation activates components on an already-running runtime.
I verified the original two-page Interactive WebAssembly scenario on current main:
[PersistentState(AllowUpdates = true)]is restored before interactive initialization on repeated enhanced navigations.Reverting the #68088 ordering change reproduces the failure for both WebAssembly and Server.