QueryParameters<T>

Describes one execution of a Query<T>: how to fetch and which callbacks to run.

public class QueryParameters<T>

Identity and fetch#

Property TypeDefaultDescription
QueryKey QueryKey?<code>null</code>Optional structured key; concurrent executions sharing a key join instead of fetching twice. String literals convert implicitly. Null means the uncached path.
QueryFunction Func<CancellationToken, Task<T>>?<code>null</code>The function that fetches the data. The token is cancelled when a newer load supersedes this one or the query is disposed; a fetch that cannot observe cancellation ignores it with a discard: _ => FetchAsync().
CancellationToken CancellationToken?<code>null</code>Caller-owned lifetime token. Null inside a DejaComponentBase component means the component's own lifetime token. A value set here replaces the ambient token rather than combining with it.
Client DejaClient?<code>null</code>Cache client override for this execution. Usually left null — components get the registered client automatically.

Callbacks#

Sync and async pairs exist for each moment; when both are set, the async one runs first. Settled callbacks run after success or a handled failure — never after cancellation. Order and the unhandled-failure contract are covered in the error handling guide.

Property TypeDescription
OnSuccessAsync / OnSuccess Func<T?, Task>? / Action<T?>?Invoked when the query succeeds, including when a keyed execution served cached data without fetching. The async form is awaited before Execute completes, so a dependent request can be chained from it.
OnErrorAsync / OnError Func<Exception, Task>? / Action<Exception>?Invoked when the query fails.
OnDisplayUserErrorAsync / OnDisplayUserError Func<DisplayUserException, Task>? / Action<DisplayUserException>?Invoked when the query fails with a DisplayUserException, before the general error callbacks.
OnSettledAsync / OnSettled Func<T?, Task>? / Action<T?>?Invoked when the query settles (success or handled error, not cancellation), including a cache hit that never fetched.

Cache behaviour (cached path only)#

Property TypeDefaultDescription
StaleTime TimeSpan?<code>null</code>Overrides DejaOptions.DefaultStaleTime for this query.
CacheTime TimeSpan?<code>null</code>Overrides DejaOptions.DefaultCacheTime for this query's entry.
RefetchOnMount RefetchOnMount?<code>null</code>Overrides DejaOptions.DefaultRefetchOnMount for this query.
Enabled bool?<code>null (enabled)</code>When false, Execute serves cached data but never fetches — for queries whose inputs aren't ready yet.
Select Func<T, T>?<code>null</code>Transforms the cached value before it is published to Data — per query, so two components can project one entry differently. The cache always stores the raw value.
PlaceholderData T?<code>null</code>Rendered as Data while the first fetch runs and the cache is empty; never written to the cache.
Defaults resolution

StaleTime, CacheTime and RefetchOnMount left null fall back to the longest matching prefix registered via DejaClient.SetDefaults, then to DejaOptions.