Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: guardrex
description: Learn how to persist user data (state) in Blazor apps using Blazor's Persistent Component State service.
monikerRange: '>= aspnetcore-8.0'
ms.author: wpickett
ms.date: 08/03/2026
ms.date: 08/18/2026
uid: blazor/state-management/prerendered-state-persistence
---
# ASP.NET Core Blazor prerendered state persistence
Expand Down Expand Up @@ -471,7 +471,7 @@ Blazor supports handling persistent component state during [enhanced navigation]

By default, persistent component state is only loaded by interactive components when they're initially loaded on the page. This prevents important state, such as data in an edited webform, from being overwritten if additional enhanced navigation events to the same page occur after the component is loaded.

If the data is read-only and doesn't change frequently, opt-in to allow updates during enhanced navigation by setting `AllowUpdates = true` on the [`[PersistentState]` attribute](xref:Microsoft.AspNetCore.Components.PersistentStateAttribute). This is useful for scenarios such as displaying cached data that's expensive to fetch but doesn't change often. The following example demonstrates the use of `AllowUpdates` for weather forecast data:
If the data is read-only and doesn't change frequently, opt-in to allow updates during enhanced navigation by setting <xref:Microsoft.AspNetCore.Components.PersistentStateAttribute.AllowUpdates%2A> to `true` on the [`[PersistentState]` attribute](xref:Microsoft.AspNetCore.Components.PersistentStateAttribute). This is useful for scenarios such as displaying cached data that's expensive to fetch but doesn't change often, such as weather forecast data in the following example:

```csharp
[PersistentState(AllowUpdates = true)]
Expand All @@ -483,6 +483,24 @@ protected override async Task OnInitializedAsync()
}
```

:::moniker-end

:::moniker range=">= aspnetcore-11.0"

> [!NOTE]
> <xref:Microsoft.AspNetCore.Components.PersistentStateAttribute.AllowUpdates%2A?displayProperty=nameWithType> doesn't control whether property mutations are captured when a circuit pauses due to [circuit state persistence](xref:blazor/state-management/server#circuit-state-persistence) or [tab inactivity](xref:blazor/state-management/server#automatic-circuit-pause-on-tab-inactivity).

:::moniker-end

:::moniker range=">= aspnetcore-10.0 < aspnetcore-11.0"

> [!NOTE]
> <xref:Microsoft.AspNetCore.Components.PersistentStateAttribute.AllowUpdates%2A?displayProperty=nameWithType> doesn't control whether property mutations are captured when a circuit pauses due to [circuit state persistence](xref:blazor/state-management/server#circuit-state-persistence).

:::moniker-end

:::moniker range=">= aspnetcore-10.0"

To skip restoring state during prerendering, set `RestoreBehavior` to `SkipInitialValue`:

```csharp
Expand Down
4 changes: 2 additions & 2 deletions aspnetcore/blazor/state-management/server.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ author: guardrex
description: Learn how to persist user data (state) in server-side Blazor apps.
monikerRange: '>= aspnetcore-3.1'
ms.author: wpickett
ms.date: 07/23/2026
ms.date: 08/18/2026
uid: blazor/state-management/server
---
# ASP.NET Core Blazor server-side state management
Expand Down Expand Up @@ -254,7 +254,7 @@ For elements without Blazor bindings (for example, `<canvas>`, WebRTC connection
> <span>@SelectedFileName</span>
>
> @code {
> [PersistentState(AllowUpdates = true)]
> [PersistentState]
> public string? SelectedFileName { get; set; }
>
> private async Task HandleFileSelected(ChangeEventArgs e)
Expand Down
Loading