[Interactive Server] State persistent doesn't work with navigation #59569
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Duplicate
Resolved as a duplicate of another issue
Status: Resolved
Is there an existing issue for this?
Describe the bug
Hello,
I've been experimenting with Blazor state persistence using
PersistentComponentState
and encountered an issue. It works as expected on the first page load, but it fails to persist state on subsequent activations triggered by link navigations. Below is the output and the test code that reproduces the issue.Test Code:
Output:
Observations:
State.TryTakeFromJson
returnsfalse
, and the persisted data is not retrieved.Issue:
Based on the above, it appears that
PersistentComponentState
does not function correctly for subsequent page activations. Is this a bug or a limitation of the current implementation? Any guidance or confirmation would be appreciatedEnvironment
.NET SDK 9.0.101
Expected Behavior
Event 4 should have
persisted=True
since event 3 is a pre-rendering step.Steps To Reproduce
dotnet new blazor -o Test
Home.razor
using the code provided above.Exceptions (if any)
No response
.NET Version
9.0.101
Anything else?
The text was updated successfully, but these errors were encountered: