Create article: Return Razor component HTML from a web API using RazorComponentResult#37405
Conversation
… Core Blazor Fixes #37404 - Add new article aspnetcore/blazor/components/return-component-html-from-a-web-api.md - Add TOC entry in aspnetcore/toc.yml after 'Class libraries with static SSR'
|
@copilot ... Apply the suggestions that I made to the PR. |
Done. Both suggestions applied in bd25d80~... — the intro paragraph now includes the article overview sentence and uses |
There was a problem hiding this comment.
Pull request overview
Adds new Blazor Components documentation describing how to return Razor component HTML from Minimal API endpoints using RazorComponentResult<T> and how to consume/render that HTML from a Blazor component, and links the new article from the ASP.NET Core TOC.
Changes:
- Added a new article at
aspnetcore/blazor/components/return-component-html-from-a-web-api.mdwith end-to-end guidance and samples. - Updated
aspnetcore/toc.ymlto include a new entry under Blazor > Components.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| aspnetcore/blazor/components/return-component-html-from-a-web-api.md | New article explaining RazorComponentResult usage in Minimal APIs and rendering the returned HTML in Blazor. |
| aspnetcore/toc.yml | Adds the new article to the Blazor Components section of the TOC. |
|
@copilot ... I agree with both of the suggestions from your review. Apply those two suggestions to the PR. |
… MarkupString security warning
Both suggestions applied in the latest commit:
|
|
@wadepickett @tdykstra ... This is my first time asking Copilot to write an article from scratch. However, I was fairly explicit with my prompt. In the future, I'll relax my prompt to see what it can do for me on its own. This hit me ...
... collaborated with the coding agent on changes will not satisfy review requirements ... 😖I didn't generate the PR or make any commits to it. This rule is too strict. It will slow down work when the issue is much simpler than this (e.g., fixing a small coding error, phrase, or misspelled word). |
|
@copilot ... Apply my suggestion for Line 6. |
That change was already applied in the previous commit — line 6 currently reads |
Fixes #37371 (Thanks @bassem-mf! 🚀)
Dan ... This is a new article covering ...
RazorComponentResult<T>at Minimal API endpoints to render Razor components as static HTML strings.IHttpClientFactory+MarkupString.New file:
aspnetcore/blazor/components/return-component-html-from-a-web-api.mdCovers three areas:
[Parameter]) in the web API projectAddRazorComponents()and mapping endpoints usingRazorComponentResult<T>, passing parameters viaDictionary<string, object?>HttpClientsetup,GetStringAsync, cast toMarkupStringfor renderingKey note surfaced in the intro: components rendered this way are static HTML only — no SignalR, no interactivity.
Updated:
aspnetcore/toc.ymlAdded "Return a component from a web API" entry immediately after "Class libraries with static SSR".
Internal previews