Skip to content

[Blazor] Support persisting component state on enhanced navigation #62824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2025

Conversation

javiercn
Copy link
Member

@javiercn javiercn commented Jul 19, 2025

Fixes #51584, #62393, #62330, #62781

Detailed design can be found #51584 (comment)

@github-actions github-actions bot added the area-blazor Includes: Blazor, Razor Components label Jul 19, 2025
@javiercn javiercn force-pushed the javiercn/enhanced-nav-agent-mode branch 2 times, most recently from e634740 to 4bc47f9 Compare July 21, 2025 09:20
@javiercn javiercn marked this pull request as ready for review July 21, 2025 09:20
@Copilot Copilot AI review requested due to automatic review settings July 21, 2025 09:20
@javiercn javiercn requested a review from a team as a code owner July 21, 2025 09:20
@javiercn javiercn changed the title Javiercn/enhanced nav agent mode [Blazor] Support persisting component state on enhanced navigation Jul 21, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements "Enhanced Nav Agent Mode", adding support for advanced persistent state management in Blazor components with enhanced navigation capabilities. The changes introduce new restore behaviors, allow state updates during enhanced navigation, and improve component state handling across different rendering scenarios.

  • New restore behaviors (SkipInitialValue, SkipLastSnapshot) for fine-grained control over when state is restored
  • Enhanced navigation support with AllowUpdates property for dynamic state updates
  • Improved state persistence management with context-aware restoration
  • Test infrastructure enhancements including filtered state properties and non-persisted counters

Reviewed Changes

Copilot reviewed 60 out of 66 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Components/test/testassets/ Added filtered state properties and non-persisted counter examples for testing
Components/test/E2ETest/ Enhanced tests for state persistence with streaming and enhanced navigation
Components/WebAssembly/WebAssembly/ Updated WebAssembly renderer to handle app state during component updates
Components/Server/ Enhanced circuit management with restore context and state update handling
Components/Components/src/ Core implementation of RestoreBehavior, RestoreContext, and enhanced state management

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This type was just split off of PersistentStateValueProvider

@javiercn javiercn requested a review from MackinnonBuck July 21, 2025 18:10
@javiercn javiercn force-pushed the javiercn/enhanced-nav-agent-mode branch from a4b2290 to 14b1124 Compare July 21, 2025 20:08
@javiercn
Copy link
Member Author

/backport to release/10.0-preview7

Copy link
Contributor

Started backporting to release/10.0-preview7: https://github.com/dotnet/aspnetcore/actions/runs/16427035175

@AlexKovynev
Copy link

@javiercn any chance for merge?

@javiercn javiercn force-pushed the javiercn/enhanced-nav-agent-mode branch from e19a454 to 2a9966d Compare August 2, 2025 12:36
@javiercn javiercn requested review from wtgodbe and a team as code owners August 2, 2025 12:36
@javiercn javiercn force-pushed the javiercn/enhanced-nav-agent-mode branch 2 times, most recently from 615d641 to 017df53 Compare August 2, 2025 18:14
* Adds support for ignoring persisted values during prerendering
* Adds support for ignoring persisted values during resume
* Adds support for receiving value updates during enhanced navigation

Fixes #51584
@javiercn javiercn force-pushed the javiercn/enhanced-nav-agent-mode branch from 017df53 to b51e028 Compare August 4, 2025 09:11
@javiercn javiercn merged commit 52ea667 into main Aug 4, 2025
30 checks passed
@javiercn javiercn deleted the javiercn/enhanced-nav-agent-mode branch August 4, 2025 13:50
@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-rc1 milestone Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support persistent component state across enhanced page navigations
4 participants