Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenz Weber committed Oct 1, 2021
1 parent 171eb9f commit 858e347
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/toolkit/src/query/react/buildHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,18 +181,28 @@ export type UseLazyQueryLastPromiseInfo<
*
* #### Note
*
* When the trigger function returned from a LazyQuery, it always initiates a new request to the server even if there is cached data. Set `preferredCacheValue`(the second argument to the function) as true if you want it to use cache.
* When the trigger function returned from a LazyQuery, it always initiates a new request to the server even if there is cached data. Set `preferCacheValue`(the second argument to the function) as true if you want it to use cache.
*/
export type UseLazyQuery<D extends QueryDefinition<any, any, any, any>> = <
R = UseQueryStateDefaultResult<D>
>(
options?: SubscriptionOptions & Omit<UseQueryStateOptions<D, R>, 'skip'>
) => [
(arg: QueryArgFrom<D>) => void,
LazyQueryTrigger<D>,
UseQueryStateResult<D, R>,
UseLazyQueryLastPromiseInfo<D>
]

export type LazyQueryTrigger<D extends QueryDefinition<any, any, any, any>> = {
/**
* Triggers a lazy query.
*
* By default, this will start a new request even if there is already a value in the cache.
* If you want to use the cache value and only start a request if there is no cache value, set the second argument to `true`.
*/
(arg: QueryArgFrom<D>, preferCacheValue?: boolean): void
}

/**
* A React hook similar to [`useQuerySubscription`](#usequerysubscription), but with manual control over when the data fetching occurs.
*
Expand Down

0 comments on commit 858e347

Please sign in to comment.