API Documentation / @pinia/colada
@pinia/colada
Pinia Colada
Interfaces
Interface | Description |
---|---|
_EntryFilter_Key | - |
_EntryFilter_NoKey | - |
DataState_Error | - |
DataState_Pending | - |
DataState_Success | - |
PiniaColadaOptions | Options for the Pinia Colada plugin. |
PiniaColadaPlugin | A Pinia Colada plugin. |
PiniaColadaPluginContext | Context passed to a Pinia Colada plugin. |
PiniaColadaQueryHooksPluginOptions | Options for PiniaColadaQueryHooksPlugin. |
TypesConfig | Allows you to extend the default types of the library. |
UseInfiniteQueryOptions | Options for useInfiniteQuery. |
UseInfiniteQueryReturn | - |
UseMutationOptions | Options to create a mutation. |
UseMutationOptionsGlobal | Options for mutations that can be globally overridden. |
UseMutationReturn | - |
UseQueryEntry | A query entry in the cache. |
UseQueryEntryExtensions | Allows defining extensions to the query entry that are returned by useQuery() . |
UseQueryOptions | Options for useQuery() . Can be extended by plugins. |
UseQueryOptionsGlobal | Options for queries that can be globally overridden. |
UseQueryReturn | Return type of useQuery() . |
Type Aliases
Type Alias | Description |
---|---|
_EntryFilter | - |
AsyncStatus | The status of an async operation tied to pinia colada e.g. queries and mutations. - idle : not loading - loading : currently loading |
DataState | Possible states for data based on its status. |
DataStateStatus | The status of data. - pending : initial state - error : has an error - success : has data |
EntryKey | Key used to identify a query or a mutation. Must be a JSON serializable value. Type is unknwon to avoid deep type recursion. |
EntryKeyTagged | Same as EntryKey but with a data tag that allows inference of the data type. Used by defineQueryOptions() . |
QueryCache | The cache of the queries. It's the store returned by useQueryCache. |
RefetchOnControl | Possible values for refetchOnMount , refetchOnWindowFocus , and refetchOnReconnect . true refetches if data is stale (calles refresh() ), false never refetches, 'always' always refetches. |
UseQueryEntryFilter | Filter object to get entries from the query cache. |
UseQueryOptionsWithDefaults | - |
Variables
Variable | Description |
---|---|
PiniaColada | Plugin that installs the Query and Mutation plugins alongside some extra plugins. |
useQueryCache | Composable to get the cache of the queries. As any other composable, it can be used inside the setup function of a component, within another composable, or in injectable contexts like stores and navigation guards. |
Functions
Function | Description |
---|---|
defineMutation | Define a mutation with the given options. Similar to useMutation(options) but allows you to reuse the mutation in multiple places. |
defineQuery | Define a query with the given options. Similar to useQuery(options) but allows you to reuse all of the query state in multiple places. It only allow static values in options. If you need dynamic values, use the function version. |
defineQueryOptions | Define type-safe query options. Can be static or dynamic. Define the arguments based on what's needed on the query and the key. Use an object if you need multiple properties. |
hydrateQueryCache | Hydrates the query cache with the serialized cache. Used during SSR. |
PiniaColadaQueryHooksPlugin | Allows to add global hooks to all queries: - onSuccess : called when a query is successful - onError : called when a query throws an error - onSettled : called when a query is settled (either successfully or with an error) |
serializeQueryCache | Serializes the query cache to a compressed version. Used during SSR. |
toCacheKey | Serializes the given key (query or mutation key) to a string. |
useInfiniteQuery | Store and merge paginated data into a single cache entry. Allows to handle infinite scrolling. This is an experimental API and is subject to change. |
useMutation | Setups a mutation. |
useQuery | Ensures and return a shared query state based on the key option. |