dotnet / dotnet/aspnetcore

[Blazor] `RazorComponentEndpointDataSource` ought to implement `GetGroupedEndpoints`

Open
#57,120 0 comments 0 reactions 0 assignees View on GitHub
area-blazor enhancement
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

`RazorComponentEndpointDataSource` ought to implement `GetGroupedEndpoints` and call `_groupConventions` first and `_groupFinallyConventions` last like `RouteEndpointDataSource`, `ControllerActionEndpointDataSource`, and `PageActionEndpointDataSource` do.

https://github.com/dotnet/aspnetcore/blob/876e36db306a4236bcdd60528305e4acd736aa2d/src/Http/Routing/src/RouteEndpointDataSource.cs#L195-L202

https://github.com/dotnet/aspnetcore/blob/876e36db306a4236bcdd60528305e4acd736aa2d/src/Mvc/Mvc.Core/src/Routing/ActionEndpointFactory.cs#L346-L350

The default virtual implementation of `GetGroupedEndpoints` provides an approximation of this, but it's not as good because group conventions are forced to run after the `_conventions` and `_finallyConventions` associated with `MapRazorComponent`. It might not be super relevant for these endpoints, but I know `WithOpenApi` looks for already-added metadata in its convention callbacks. The default implementation also prevents a group from injecting any "inner" [endpoint filters](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/minimal-apis/min-api-filters).

https://github.com/dotnet/aspnetcore/blob/5c2dce53828a4435326ae0bce1698a3b8e4824a8/src/Http/Routing/src/EndpointDataSource.cs#L67-L72

These are pretty niche problems. We tried to make the default implementation of `GetGroupedEndpoints` as good as possible, but we might as well align behavior with our other EndpointDataSources for maximum correctness.

_Originally posted by @halter73 in https://github.com/dotnet/aspnetcore/pull/57086#discussion_r1699059969_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.