Skip to content

Commit de5750d

Browse files
committed
More cleanups
1 parent 7a6f848 commit de5750d

File tree

5 files changed

+8
-46
lines changed

5 files changed

+8
-46
lines changed

src/Components/Server/src/Builder/ComponentEndpointBuilderExtensions.cs renamed to src/Components/Server/src/Builder/EndpointBuilderComponentExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ namespace Microsoft.AspNetCore.Builder
1010
/// <summary>
1111
/// Extensions for <see cref="IEndpointConventionBuilder"/>.
1212
/// </summary>
13-
public static class IEndpointConventionBuilderExtensions
13+
public static class EndpointConventionBuilderComponentsExtensions
1414
{
1515
/// <summary>
1616
/// Adds <typeparamref name="TComponent"/> to the list of components registered with this <see cref="ComponentHub"/> instance.
1717
/// </summary>
1818
/// <typeparam name="TComponent">The component type.</typeparam>
1919
/// <param name="builder">The <see cref="IEndpointConventionBuilder"/>.</param>
20-
/// <param name="selector">The component selector in the DOM for the <typeparamref name="TComponent"/>.</param>
20+
/// <param name="selector">A CSS selector that identifies the DOM element into which the <typeparamref name="TComponent"/> will be placed.</param>
2121
/// <returns>The <paramref name="builder"/>.</returns>
2222
public static IEndpointConventionBuilder AddComponent<TComponent>(this IEndpointConventionBuilder builder, string selector)
2323
{

src/Components/Server/src/Circuits/DefaultCircuitFactory.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,15 @@ private static IList<ComponentDescriptor> ResolveComponentMetadata(HttpContext h
9696
var endpoint = endpointFeature?.Endpoint;
9797
if (endpoint == null)
9898
{
99-
throw new InvalidOperationException("CompnentHub doesn't have an associated endpoint.");
99+
throw new InvalidOperationException(
100+
"ComponentHub doesn't have an associated endpoint. " +
101+
"Use 'app.UseRouting(routes => routes.MapComponentHub<App>(\"app\"))' to register your hub.");
100102
}
101103

102104
var componentsMetadata = endpoint.Metadata.OfType<ComponentDescriptor>().ToList();
103105
if (componentsMetadata.Count == 0)
104106
{
105-
throw new InvalidOperationException("No component was added to the component hub.");
107+
throw new InvalidOperationException("No component was registered with the component hub.");
106108
}
107109
else
108110
{

src/Components/test/testassets/ComponentsApp.Server/Pages/Index.cshtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
@page "{*clientroutes}"
22
@using ComponentsApp.App
3-
@model ComponentsApp.Server.Pages.IndexModel
4-
@{
5-
}
3+
64
<!DOCTYPE html>
75
<html>
86
<head>
@@ -19,4 +17,3 @@
1917
<script src="_framework/components.server.js"></script>
2018
</body>
2119
</html>
22-

src/Components/test/testassets/ComponentsApp.Server/Pages/Index.cshtml.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/Mvc/Mvc.ViewFeatures/src/Infrastructure/HttpUriHelper.cs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,30 +51,9 @@ private string GetContextBaseUri()
5151

5252
protected override void NavigateToCore(string uri, bool forceLoad)
5353
{
54-
// For now throw.
55-
// We don't have a good way to do redirects on a prerendering context.
56-
// Currently there's no good way to stop the rendering process. We can fix
57-
// this by passing in a cancellation token to RenderRootComponentAsync and
58-
// having that checked before we await on every ProcessAsynchronousWork iteration
59-
// if we choose to go that way. Upon redirect we could trigger the cancellation here
60-
// and do _context.Response.Redirect(uri)
61-
// The bigger (not easily solvable problem) is that the response might have already
62-
// started (for example when the page/view has already been flushed) which will mean
63-
// that the behavior of this feature is not reliable, and not easily to diagnose as
64-
// the developer only notices it when this happens at runtime; something we don't really want.
54+
// For now throw as we don't have a good way of aborting the request from here.
6555
throw new InvalidOperationException(
6656
"Redirects are not supported on a prerendering environment.");
67-
68-
// We need to do something here about the hash to prevent infinite redirects
69-
// as the hash portion of a url doesn't get sent to the browser.
70-
// This means that the hash won't be respected for prerendering scenarios.
71-
// There are several involved things that we could do. Bake the knowledge into
72-
// the IUriHelper abstraction so that we can produce a special link where we
73-
// encode the hash as a query stirng parameter.
74-
// We would preprocess this on the server to set the appropriate url.
75-
// For example:
76-
// CurrentUrl = "http://www.localhost/base/path?query=value#top
77-
// Redirect = "http://www.localhost/base/path?query=value#first
7857
}
7958
}
8059
}

0 commit comments

Comments
 (0)