Skip to content

API Documentation / @pinia/colada / UseQueryOptionsGlobal

Interface: UseQueryOptionsGlobal ​

Options for queries that can be globally overridden.

Extends ​

Properties ​

autoRefetch? ​

ts
optional autoRefetch?: number | boolean | (<T>(state) => number | boolean);

Whether to enable auto refresh by default.

Default ​

ts
false

Inherited from ​

PiniaColadaAutoRefetchOptions.autoRefetch


delay? ​

ts
optional delay?: number | false;

Delay in milliseconds to wait before letting the asyncStatus become 'loading'. Set to false or 0 to disable.

Default ​

ts
200

enabled? ​

ts
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? ​

ts
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 ​

ts
300_000 (5 minutes)

placeholderData? ​

ts
optional 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? ​

ts
optional refetchOnMount?: MaybeRefOrGetter<RefetchOnControl>;

Whether to refetch the query when the component is mounted.

Default ​

ts
true

refetchOnReconnect? ​

ts
optional refetchOnReconnect?: MaybeRefOrGetter<RefetchOnControl>;

Whether to refetch the query when the network reconnects.

Default ​

ts
true

refetchOnWindowFocus? ​

ts
optional refetchOnWindowFocus?: MaybeRefOrGetter<RefetchOnControl>;

Whether to refetch the query when the window regains focus.

Default ​

ts
true

ssrCatchError? ​

ts
optional ssrCatchError?: boolean;

Whether to catch errors during SSR (onServerPrefetch) when the query fails.

Default ​

ts
false

staleTime? ​

ts
optional staleTime?: number;

Time in ms after which the data is considered stale and will be refreshed on next read.

Default ​

ts
5000 (5 seconds)

Released under the MIT License.