RefetchParameters<T>
The parameters a Query<T>.Refetch may override, for that call only.
public class RefetchParameters<T>
The identity of the query — key, fetch function, client — always comes from the last
Execute: changing those is a new query, not a refetch. A property left null keeps
the value the last Execute used, and a later bare Refetch() is
unaffected by earlier overrides.
Properties#
| Property | Type | Description |
|---|---|---|
| CancellationToken | CancellationToken? | Replaces the token for this refetch. |
| OnSuccessAsync / OnSuccess | Func<T?, Task>? / Action<T?>? | Replace the success callbacks for this refetch. |
| OnErrorAsync / OnError | Func<Exception, Task>? / Action<Exception>? | Replace the error callbacks for this refetch. |
| OnDisplayUserErrorAsync / OnDisplayUserError | Func<DisplayUserException, Task>? / Action<DisplayUserException>? | Replace the display-user error callbacks for this refetch. |
| OnSettledAsync / OnSettled | Func<T?, Task>? / Action<T?>? | Replace the settled callbacks for this refetch. |
| StaleTime | TimeSpan? | Replaces the stale time for this refetch. The refetch itself always fetches; this only changes how soon the fresh result counts as stale again. |
| CacheTime | TimeSpan? | Replaces the cache time for this refetch. |
Example#
await _todos.Refetch(new RefetchParameters<List<Todo>>
{
StaleTime = TimeSpan.FromMinutes(1),
OnSettled = _ => _lastRefreshed = DateTimeOffset.Now,
});