Skip to content

API Documentation / @pinia/colada / DefineQueryOptions

Type Alias: DefineQueryOptions<TData, TError, TDataInitial>

ts
type DefineQueryOptions<TData, TError, TDataInitial> = Omit<_RemoveMaybeRef<UseQueryOptions<TData, TError, TDataInitial>>, "initialData" | "placeholderData"> & object;

Options to define a query with defineQuery(). Similar to UseQueryOptions but disallows reactive values as defineQuery() is used outside of an effect scope.

Type declaration

initialData()?

ts
optional initialData: () => TDataInitial;

The data which is initially set to the query while the query is loading for the first time. Note: unlike with placeholderData, setting the initial data changes the state of the query (it will be set to success).

Returns

TDataInitial

See

placeholderData

placeholderData?

ts
optional placeholderData: 
  | NoInfer<TDataInitial>
  | NoInfer<TData>
  | <T>(previousData) => NoInfer<TDataInitial> | NoInfer<TData> | undefined;

A placeholder data that is initially shown while the query is loading for the first time. This will also show the status as success until the query finishes loading (no matter the outcome of the query). Note: unlike with initialData, the placeholder does not change the cache state.

See

initialData

Type Parameters

TData

TData = unknown

TError

TError = ErrorDefault

TDataInitial

TDataInitial extends TData | undefined = undefined

Released under the MIT License.