API Documentation / @pinia/colada / UseQueryOptionsGlobal
Interface: UseQueryOptionsGlobal ​
Options for queries that can be globally overridden.
Extends ​
PiniaColadaAutoRefetchOptionsPick<PiniaColadaDelayOptions,"delay">
Properties ​
autoRefetch? ​
autoRefetch?: number | boolean | (<T>(state) => number | boolean);Whether to enable auto refresh by default.
Default ​
falseInherited from ​
PiniaColadaAutoRefetchOptions.autoRefetch
delay? ​
delay?: number | false;Delay in milliseconds to wait before letting the asyncStatus become 'loading'. Set to false or 0 to disable.
Default ​
200enabled? ​
enabled?: MaybeRefOrGetter<boolean>;Whether the query should be enabled or not. If false, the query will not be executed until refetch() or refresh() is called. If it becomes true, the query will be refreshed.
gcTime? ​
gcTime?: number | false;Time in ms after which, once the data is no longer being used, it will be garbage collected to free resources. Set to false to disable garbage collection.
Default ​
300_000 (5 minutes)placeholderData? ​
placeholderData?: (previousData, previousEntry) => any;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.
Parameters ​
previousData ​
unknown
previousEntry ​
| UseQueryEntry<unknown, unknown, unknown> | undefined
Returns ​
any
refetchOnMount? ​
refetchOnMount?: MaybeRefOrGetter<RefetchOnControl>;Whether to refetch the query when the component is mounted.
Default ​
truerefetchOnReconnect? ​
refetchOnReconnect?: MaybeRefOrGetter<RefetchOnControl>;Whether to refetch the query when the network reconnects.
Default ​
truerefetchOnWindowFocus? ​
refetchOnWindowFocus?: MaybeRefOrGetter<RefetchOnControl>;Whether to refetch the query when the window regains focus.
Default ​
truessrCatchError? ​
ssrCatchError?: boolean;Whether to catch errors during SSR (onServerPrefetch) when the query fails.
Default ​
falsestaleTime? ​
staleTime?: number;Time in ms after which the data is considered stale and will be refreshed on next read.
Default ​
5000 (5 seconds)