-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Progressively enhanced form posts #48939
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
Progressively enhanced form posts #48939
Conversation
@using Components.TestServer.RazorComponents.Pages.Forms | ||
@using Components.TestServer.RazorComponents.Shared | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<base href="/subdir/" /> | ||
<HeadOutlet /> | ||
</head> | ||
<body> | ||
<Router AppAssembly="@typeof(FormWithDefaultContextApp).Assembly"> | ||
<Found Context="routeData"> | ||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(FormsLayout)" /> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView> | ||
<p role="alert">Sorry, there's nothing at this address.</p> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> | ||
<script src="_framework/blazor.web.js" suppress-error="BL9992"></script> | ||
</body> | ||
</html> |
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.
Is this not used?
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.
It's not a big deal, but this was only used to vary the layout, so I added a _Imports.razor
to set the layout for forms test pages instead. It's only so we can keep the E2E tests runnable manually (by launching TestServer
), which is much easier when they have a common root component.
For cases where it's completely necessary to vary the root component I guess we have no choice, and then would have to add some new entry to the list of test apps, but whenever we can avoid growing that it will be easier to find the test case you want.
I don't know if there are tests for redirects, specifically, should we add them? |
It will work with PRG already because the existing enhanced nav logic handles redirects pretty thoroughly. What won't be supported here is a 307 redirect (it will behave like a 302 instead). I'll file an issue to track that. What's your view on the level of importance of supporting 307? |
Actually that's only partly true. I think (but haven't confirmed) it will work with a 307 as long as it's a true 307 from the server and that it goes to a URL in the same origin, based on the expectation that What wouldn't work is if you're in the middle of streaming rendering and try to issue a 307 - you simply can't because there's no way to set a status code. Our existing mechanism handles So for now I don't think there's any action to take on that, but if we get developer feedback that they need to be able to describe other types of redirections during streaming SSR, we'd have to take that as a future enhancement. |
Implements #48762
This extends the progressively enhanced nav feature to handle form posts too. It's a relatively straightforward extension of what was there before.
The great majority of this PR concerns E2E tests, in part because I reorganized the enhanced nav tests into a subfolder and changed their URLs to make things more organized now we are getting so many E2E tests for SSR.