Repository navigation
Fix Persistent Component State for Re-executed Endpoints - #68032
Merged
Merged
Conversation
Contributor
|
Thanks for your PR, @Yuvan111. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
ilonatommy
reviewed
Jul 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes persisted component state emission for endpoint re-execution scenarios (e.g., StatusCodePages re-executing a request to render an interactive NotFound page). This aligns persistent state behavior with expected hydration requirements: suppress state only for exception-handler responses, not for re-executed endpoints.
Changes:
- Update
RazorComponentEndpointInvokerto emit persisted component state during endpoint re-execution (but still suppress it for exception-handler responses). - Extend the interactive re-executed NotFound test page to include a persistent-state component.
- Add an E2E test validating that persisted state is restored and that the persisted-state marker is present in the raw HTML response for a re-executed NotFound page.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Components/test/testassets/TestContentPackage/NotFound/ReexecutedPageInteractive.razor | Adds a persistent-state component to the interactive re-executed NotFound page to validate restoration. |
| src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs | Adds an E2E test asserting persisted state restoration and presence of the persisted-state marker for re-executed NotFound responses. |
| src/Components/Endpoints/src/RazorComponentEndpointInvoker.cs | Changes persisted-state emission to be skipped only for exception-handler responses (not re-executed endpoints). |
ilonatommy
reviewed
Aug 5, 2026
ilonatommy
approved these changes
Aug 5, 2026
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
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.
Fix Persistent Component State for Re-executed Endpoints
Description
When a request results in endpoint re-execution (for example, navigating to a non-existent route that is re-executed to render a /not-found page), persisted component state is not emitted to the response. As a result, components using persistent state lose their prerendered state during hydration and behave as if no state was persisted.
The root cause is that persisted state rendering is currently skipped for both error handlers and re-executed requests. However, persisted state should only be suppressed for error handler responses. Re-executed endpoints, including interactive NotFound pages, still require persisted state to be rendered.
Changes
Before
After
Testing
Fixes #64386