-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Unify the UX of template projects on navigation to non-existing page #62067
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
ilonatommy
merged 22 commits into
dotnet:main
from
ilonatommy:not-found-works-after-navigation
May 30, 2025
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5fff491
Add re-exec tests for SSR + move NotFound sources into one directory.
ilonatommy 66cc974
Per-component interactivity: test navigation to non-existing page.
ilonatommy 8907524
Add streaming SSR tests.
ilonatommy 3b89c4b
Clean up tests and make them work.
ilonatommy 217e8dd
Fix interactivity tests.
ilonatommy 6e3eb98
Remove routing sandwitch.
ilonatommy e89fe2d
Trigger streaming.
ilonatommy e4b89c1
Templates use reexecution.
ilonatommy 0f52575
Merge branch 'main' into not-found-works-after-navigation
ilonatommy fe7074f
Fix templates and layout.
ilonatommy 1c2dcae
Fix namespace.
ilonatommy 9f6df01
Make sure that interactive tests work only when interactivity is on.
ilonatommy b69773a
Fix: link has to have ID to check if layout is rendered.
ilonatommy 6b439b5
Merge branch 'main' into not-found-works-after-navigation
ilonatommy f1bbf65
Fix: Wrong placing of NotFoundPage parameter.
ilonatommy a10a0fb
Whitespace
ilonatommy 561c04c
Empty templates should not contain `NotFound.razor`.
ilonatommy 8d96617
Move layout import for -ai Auto from server to client project.
ilonatommy 90f6f0f
Feedback: use `RouteView`.
ilonatommy bdc5050
Feedback: explicit layout passing is not necessary when rendering wit…
ilonatommy 05169c9
Fix misscommit.
ilonatommy 1e207c2
Add error pages middlewarefor reexecution + use status code pages on …
ilonatommy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
2 changes: 1 addition & 1 deletion
2
src/Components/test/testassets/Components.TestServer/RazorComponents/App.razor
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
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
...ponents.TestServer/RazorComponents/Pages/NotFound/RedirectionNotFound-SSR-streaming.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@page "/redirection-not-found-ssr-streaming" | ||
@page "/reexecution/redirection-not-found-ssr-streaming" | ||
@attribute [StreamRendering(true)] | ||
|
||
<Components.WasmMinimal.Pages.NotFound.RedirectionNotFoundComponent StartStreaming="true" /> |
5 changes: 5 additions & 0 deletions
5
...assets/Components.TestServer/RazorComponents/Pages/NotFound/RedirectionNotFound-SSR.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@page "/redirection-not-found-ssr" | ||
@page "/reexecution/redirection-not-found-ssr" | ||
@attribute [StreamRendering(false)] | ||
|
||
<Components.WasmMinimal.Pages.NotFound.RedirectionNotFoundComponent /> |
File renamed without changes.
4 changes: 0 additions & 4 deletions
4
src/Components/test/testassets/Components.WasmMinimal/Pages/CustomNotFoundPage.razor
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...Components/test/testassets/Components.WasmMinimal/Pages/NotFound/CustomNotFoundPage.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@page "/render-custom-not-found-page" | ||
@layout NotFoundLayout | ||
|
||
<h3 id="test-info">Welcome On Custom Not Found Page</h3> | ||
<p>Sorry, the page you are looking for does not exist.</p> |
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
src/Components/test/testassets/Components.WasmMinimal/Pages/NotFound/NotFoundLayout.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<div class="page"> | ||
<header class="top-bar"> | ||
<a id="about-link" href="https://learn.microsoft.com/aspnet/core/" target="_blank">About</a> | ||
</header> | ||
<main> | ||
<article class="content px-4"> | ||
@Body | ||
</article> | ||
</main> | ||
</div> | ||
|
||
<style> | ||
.top-bar { | ||
background-color: #0078d4; | ||
color: white; | ||
padding: 10px; | ||
text-align: center; | ||
width: 100%; | ||
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2); | ||
} | ||
</style> |
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
...st/testassets/Components.WasmMinimal/Pages/NotFound/RedirectionNotFound-Interactive.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
@page "/redirection-not-found" | ||
@page "/reexecution/redirection-not-found" | ||
|
||
<RedirectionNotFoundComponent @rendermode="@RenderModeHelper.GetRenderMode(_renderMode)" WaitForInteractivity="true"/> | ||
|
||
@code{ | ||
[Parameter, SupplyParameterFromQuery(Name = "renderMode")] | ||
public string? RenderModeStr { get; set; } | ||
|
||
private RenderModeId _renderMode; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
if (!string.IsNullOrEmpty(RenderModeStr)) | ||
{ | ||
_renderMode = RenderModeHelper.ParseRenderMode(RenderModeStr); | ||
} | ||
else | ||
{ | ||
throw new ArgumentException("RenderModeStr cannot be null or empty. Did you mean to redirect to /redirection-not-found-ssr?", nameof(RenderModeStr)); | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
.../test/testassets/Components.WasmMinimal/Pages/NotFound/RedirectionNotFoundComponent.razor
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@inject NavigationManager NavigationManager | ||
|
||
@if (!WaitForInteractivity || RendererInfo.IsInteractive) | ||
{ | ||
<h1>Original page</h1> | ||
|
||
<p id="test-info">Any content</p> | ||
<a id="link-to-not-existing-page" href="@_nonExistingPath"> | ||
Go to not-existing-page | ||
</a> | ||
} | ||
|
||
@code{ | ||
[Parameter] | ||
[SupplyParameterFromQuery(Name = "navigate-programmatically")] | ||
public bool? NavigateProgrammatically { get; set; } | ||
|
||
[Parameter] | ||
public bool StartStreaming { get; set; } = false; | ||
|
||
[Parameter] | ||
public bool WaitForInteractivity { get; set; } = false; | ||
|
||
private string _nonExistingPath = string.Empty; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
if (StartStreaming) | ||
{ | ||
await Task.Yield(); | ||
} | ||
_nonExistingPath = $"{NavigationManager.BaseUri}reexecution/not-existing-page"; | ||
if (NavigateProgrammatically == true) | ||
{ | ||
NavigationManager.NavigateTo(_nonExistingPath); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.