API Documentation / @pinia/colada / UseQueryOptionsGlobal
Interface: UseQueryOptionsGlobal
Options for queries that can be globally overridden.
Extends
PiniaColadaAutoRefetchOptions.PiniaColadaDelayOptions
Properties
autoRefetch?
optional autoRefetch: number | boolean | <T>(state) => number | boolean;Whether to enable auto refresh by default.
Default
falseInherited from
PiniaColadaAutoRefetchOptions.autoRefetch
delay?
optional delay: number | false;Delay in milliseconds to wait before letting the asyncStatus become 'loading'. Set to false or 0 to disable. Requires the PiniaColadaDelay plugin.
Default
200enabled?
optional 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?
optional 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()?
optional placeholderData: (previousData) => 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
Returns
any
refetchOnMount?
optional refetchOnMount: MaybeRefOrGetter<RefetchOnControl>;Whether to refetch the query when the component is mounted.
Default
truerefetchOnReconnect?
optional refetchOnReconnect: MaybeRefOrGetter<RefetchOnControl>;Whether to refetch the query when the network reconnects.
Default
truerefetchOnWindowFocus?
optional refetchOnWindowFocus: MaybeRefOrGetter<RefetchOnControl>;Whether to refetch the query when the window regains focus.
Default
truessrCatchError?
optional ssrCatchError: boolean;Whether to catch errors during SSR (onServerPrefetch) when the query fails.
Default
falsestaleTime?
optional staleTime: number;Time in ms after which the data is considered stale and will be refreshed on next read.
Default
5000 (5 seconds)