Skip to content

Conversation

@javiercn
Copy link
Member

No description provided.

@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 from 14c6c87 to c293809 Compare July 19, 2025 16:50
@javiercn javiercn changed the base branch from main to release/10.0-preview7 July 19, 2025 16:50
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 logic was just extracted from the original PersistentStateValueProvider

#62825)

[main] Source code updates from dotnet/dotnet
@javiercn javiercn force-pushed the javiercn/enhanced-nav-agent-mode branch from 119f3ee to fe1d427 Compare July 20, 2025 18:25
ilonatommy and others added 18 commits July 21, 2025 07:25
* Support application subscribing to `OnNotFound` and setting `NotFoundEventArgs.Path`.

* Path from args has higher priority than `NotFoundPage`.

* Throw if path does not match any component.
This commit introduces a scenario-based persistent component state system for
Blazor components, focusing on the prerendering scenario. It enables
developers to control precisely which state is restored during specific
restoration scenarios.

Key changes:

Core abstractions:
- Add IPersistentComponentStateScenario interface to represent state restoration contexts
- Add IPersistentStateFilter interface for filtering state restoration based on scenarios
- Implement WebPersistenceScenario with Prerendering scenario support
- Add WebPersistenceFilter for scenario-specific state filtering

Attribute-based filtering:
- Add RestoreStateOnPrerenderingAttribute to control state restoration during prerendering
- On by default, can be opt-out with [RestoreStateOnPrerendering(false)]

Infrastructure enhancements:
- Refactor PersistentComponentState to support scenario-based filtering
- Extend PersistentStateValueProvider with filtered subscription groups
- Update ComponentStatePersistenceManager with scenario-aware callback management
- Update interactive host initialization (WebAssemblyHost, CircuitHost, CircuitFactory)
  to pass WebPersistenceScenario.Prerendering during state restoration

Testing:
- Add unit tests for filtering logic in ComponentStatePersistenceManagerTest
- Update PersistentStateValueProviderTests for filter behavior validation
- Enhance DeclarativePersistStateComponent.razor to test attribute-based filtering
- Update E2E tests in InteractivityTest.cs to verify prerendering filtering behavior
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants