Skip to content

Commit bde967d

Browse files
authored
State persistence w/enhanced nav (#31276)
1 parent dc64c7d commit bde967d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aspnetcore/blazor/components/prerender.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ To retain the initial value of the counter during prerendering, Blazor supports
7777

7878
To preserve prerendered state, decide what state to persist using the <xref:Microsoft.AspNetCore.Components.PersistentComponentState> service. <xref:Microsoft.AspNetCore.Components.PersistentComponentState.RegisterOnPersisting%2A?displayProperty=nameWithType> registers a callback to persist the component state before the app is paused. The state is retrieved when the app resumes.
7979

80+
> [!IMPORTANT]
81+
> Persisting component state only works during the initial render of a component and not across enhanced page navigations. Currently, the <xref:Microsoft.AspNetCore.Components.PersistentComponentState> service isn't aware of enhanced navigations, and there's no mechanism to deliver state updates to components that are already running. A mechanism to deliver state updates for enhanced navigations is planned for .NET 9, which is targeted for release in late 2024. For more information, see [[Blazor] Support persistent component state across enhanced page navigations (dotnet/aspnetcore #51584)](https://github.com/dotnet/aspnetcore/issues/51584). For more information on enhanced navigation, see <xref:blazor/fundamentals/routing#enhanced-navigation-and-form-handling>.
82+
8083
The following example demonstrates the general pattern:
8184

8285
* The `{TYPE}` placeholder represents the type of data to persist.

0 commit comments

Comments
 (0)