-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Change priority of re-execution handling and allow client to render NotFound
contents
#62178
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
Change priority of re-execution handling and allow client to render NotFound
contents
#62178
Conversation
…o shared project + redefine test cases.
src/Components/test/E2ETest/ServerRenderingTests/NoInteractivityTest.cs
Outdated
Show resolved
Hide resolved
src/Components/test/E2ETest/ServerRenderingTests/NoInteractivityTest.cs
Outdated
Show resolved
Hide resolved
Adding |
Failures connected with Router's streaming inferencing with enhanced navigation, e.g.:
Starting investigation on why the whole page, including constant elements, changes on streaming. |
In
and we trigger SendStreamingUpdatesAsync that, in contrast to EmitInitializersIfNecessary , starts the response. It's important in the context of how we handle the navigation. With Router that streams we fall into a _httpContext.Response.HasStarted=true path of processing navigation:https://github.com/dotnet/aspnetcore/blob/1415d9bbe18c8ba97e9eb5a9618b5c149a261e3e/src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.EventDispatch.cs#L105C1-L116C10 Using Edit:
fixes it but that's not a way to do it. It would break the scenarios where we really want to stream-in the changes. |
oldTree as ampty array (why? Under investigation...) so logically, it builds the new view from scratch.edit: this behavior is not influenced by Router streaming settings.
|
Functional test failures are connected with empty streaming markers added to the response, e.g.
|
Topics for to discuss in a follow-up:
|
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.
Pull Request Overview
This pull request updates the re-execution middleware priority and enables custom NotFound content streaming for the Router along with adjustments in test assets and client-side navigation.
- Adjusts the ordering and rendering logic for NotFound middleware and pages
- Updates test pages and end-to-end tests to verify behavior under both streaming and non-streaming scenarios
- Modifies enhanced navigation and streaming rendering in JS and endpoint rendering components
Reviewed Changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
Components.Shared/Index.razor | Updates to test pages for NotFound behavior and navigation links |
Components.Shared/ComponentThatSetsNotFound.razor | Updated logic to trigger NotFound navigation |
Components.Shared/ComponentThatPostsNotFound.razor | Updated logic to trigger NotFound navigation on form submission |
E2ETest files | Adjusted tests to account for enhanced navigation and streaming variants |
Web.JS files (NavigationEnhancement.ts, StreamingRendering.ts) | Modifications to support URL change controls and streaming updates |
Endpoints and Components files | Updates to NotFound handling, including new constructor arguments and event dispatching |
Co-authored-by: Copilot <[email protected]>
src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.EventDispatch.cs
Outdated
Show resolved
Hide resolved
// Attach pathFormat to HttpContext.Items early in the pipeline | ||
context.Items[nameof(StatusCodePagesOptions)] = _options.PathFormat; | ||
|
||
await _next(context); | ||
|
||
// Remove pathFormat from HttpContext.Items after handler execution | ||
context.Items.Remove(nameof(StatusCodePagesOptions)); | ||
|
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.
Not suggesting we change this right now, but maybe this should go into https://github.com/dotnet/aspnetcore/blob/main/src/Middleware/Diagnostics/src/StatusCodePage/StatusCodePagesFeature.cs instead.
The items dictionary is typically not used by the framework itself.
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.
But that's public API 🫨
…g, unless user explicitly disbled it.
…hanced nav, actual request headers do not matter.
Most of it is addressed in this PR. Server always requests rendering |
NotFound
contents NotFound
contents
Contributes to #62153.
Description
NotFound
contents.Router
, then in all the cases we should renderNotFoundPage
contents and if page is not available, then we can renderNotFound
fragment if streaming has not started.NotFound
contents.NotFound
contents but prevent the url change. This will happen on JS-initiated navigations. If enhanced navigation is off or the navigation is initiated by the browser (e.g. mistype in the url bar) then we redirect toNotFound
, which includes url change.NotFound
url when streaming:Router
hasNotFoundPage
type passed, it's getting rendered, otherwise we rely on the url passed to re-execution middleware.NotFound
fragment cannot be rendered this way.TestContentPackage
.We want the same components to be tested in global interactivity application (InteractivityTests.cs
that is runningComponents.WasmMinimal.csproj
) and per-component interactivity application (NoInteractivityTests.cs
that is runningComponents.TestServer.csproj
that is not loadingWasmMinimal
assembly). The neatest solution was to put the common components is an external razor library.PageThatSetsNotFound
andStreamingSetNotFound
components were doing the same job as new tests but the new version is doing it in amore unified way, taking into consideration both POST and GET request, with and without enhanced navigation.