Skip to content

SwrResult<T> class

Represents the result of an SWR cache lookup. Properties update asynchronously as data flows through cache hit, network fetch, and background revalidation.

public sealed class SwrResult<T>
parameterdescription
TThe type of the fetched data.
namedescription
SwrResult()The default constructor.
Completed { get; }A task that completes when the initial data is available. Await this in Blazor’s OnInitializedAsync to block rendering until data is ready.
Data { get; }The fetched data, or default if still loading or an error occurred.
Error { get; }The error message if the fetch failed, or null on success.
IsFromCache { get; }True if the current Data value was served from cache rather than a fresh network response.
IsLoading { get; }True while a network request is in progress (initial fetch or background revalidation).