feat(useQuery): prefetch option
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
|
||||
- `notifyOnNetworkStatusChange`: Whether or not updates to the network status should trigger next on the observer of this query.
|
||||
|
||||
- `prefetch`: (default: `true`) Enable prefetching on the server during Server-Side Rendering.
|
||||
|
||||
- `pollInterval`: The time interval (in milliseconds) on which this query should be refetched from the server.
|
||||
|
||||
- `returnPartialData`: Allow returning incomplete data from the cache when a larger query cannot be fully satisfied by the cache, instead of returning nothing.
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface UseQueryOptions<
|
||||
enabled?: boolean
|
||||
throttle?: number
|
||||
debounce?: number
|
||||
prefetch?: boolean
|
||||
}
|
||||
|
||||
interface SubscribeToMoreItem {
|
||||
@@ -93,6 +94,8 @@ export function useQuery<
|
||||
*/
|
||||
function start () {
|
||||
if (started || !isEnabled.value) return
|
||||
if (isServer && currentOptions.value.prefetch === false) return
|
||||
|
||||
started = true
|
||||
loading.value = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user