- 
                Notifications
    
You must be signed in to change notification settings  - Fork 10.5k
 
[Blazor] Support persisting component state on enhanced navigation #62822
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
          
     Closed
      
      
    Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    #62818) [main] Source code updates from dotnet/dotnet
14c6c87    to
    c293809      
    Compare
  
    
              
                    javiercn
  
              
              commented
              
                  
                    Jul 19, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
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
119f3ee    to
    fe1d427      
    Compare
  
    * 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
…updates even when no components change
e634740    to
    4bc47f9      
    Compare
  
    
  This was referenced Jul 21, 2025 
      
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
No description provided.