Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Fetches backend API data into Blazor components, handling HttpClient registration, async loading states, and Auto/WebAssembly render modes.
68% 86%+18 ptsof test cases passed
Passed 19 of 22 test cases with the skill, and 15 of 22 without it.
Write a Blazor component error handling section that allows users to retry loading category items when a timeout occurs, while logging the error.
The catch clause targets OperationCanceledException using a condition checking !cancellationToken.IsCancellationRequested.
3 of 3 safety checks passed
Check Interactivity Mode and Scope:
| Mode | Data access |
|---|---|
| None (Static SSR) | Server-side: inject services/DbContext. Use [StreamRendering] for loading UX. |
| Server | Server-side: inject services/DbContext. Guard prerender with ??= + [PersistentState]. |
| WebAssembly | Browser-side: HttpClient only. No direct server access. |
| Auto | Both server and browser. Always go through an API. |
Only needed when calling external APIs from Server, or always for WebAssembly/Auto. Server components accessing their own database should inject DbContext or a service directly.
// Named client — requires Microsoft.Extensions.Http NuGet
builder.Services.AddHttpClient("CatalogAPI", client =>
{
client.BaseAddress = new Uri("https://api.example.com/");
});
// Typed client
builder.Services.AddHttpClient<CatalogClient>(client =>
client.BaseAddress = new Uri("https://api.example.com/"));
For WebAssembly/Auto with prerendering, register in both server and .Client Program.cs.
@page "/products"
@inject CatalogClient Catalog
@if (products is null)
Next to this one in the catalogue, plus more from the same author.