Table of Contents

Constructor QueryOptions

Namespace
Velvet
Assembly
Velvet.Docs.dll

QueryOptions(QueryKey, Func<CancellationToken, VelvetTask<TQueryFnData>>)

Options passed to UseQuery<TQueryFnData, TData>(QueryOptions<TQueryFnData, TData>, QueryClient?): TanStack Query's { queryKey, queryFn } with its enabled, select, placeholderData, staleTime, gcTime, refetchInterval, refetchIntervalInBackground, refetchOnWindowFocus, refetchOnReconnect, retry, retryDelay, structuralSharing and notifyOnChangeProps. QueryOptions<T> is the form without a Select that changes the data's type.

public QueryOptions(QueryKey QueryKey, Func<CancellationToken, VelvetTask<TQueryFnData>> QueryFn)

Parameters

QueryKey QueryKey

Names the cache entry. Queries presenting equal keys share one entry.

QueryFn Func<CancellationToken, VelvetTask<TQueryFnData>>

Fetches the entry's data. The token is cancelled when a refetch starts over this request, when Clear() removes the entry, and when the last query reading the entry leaves while the request is in flight, which also puts the entry back as it stood before the request started: TanStack Query aborts the request of a query function that read its signal in the same case. A function taking the token counts as having read it. The constructor taking a function without a token is the one whose request runs on after the last reader leaves, as TanStack Query's does for a function that never reads its signal.

QueryOptions(QueryKey, Func<VelvetTask<TQueryFnData>>)

Options whose query function takes no token: its request is not cancelled when the last query reading the entry leaves, and lands in the entry for the next reader to find.

public QueryOptions(QueryKey queryKey, Func<VelvetTask<TQueryFnData>> queryFn)

Parameters

queryKey QueryKey

Names the cache entry. Queries presenting equal keys share one entry.

queryFn Func<VelvetTask<TQueryFnData>>

Fetches the entry's data.