Skip to content

Commit 7897c4c

Browse files
authored
Merge pull request #4847 from Tasin5541/doc-lazy-query-reset
doc: update type definitions for lazy query hooks to include reset method
2 parents 801d7ea + cdb264f commit 7897c4c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/rtk-query/api/created-api/hooks.mdx

+4-2
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ const [trigger, result, lastPromiseInfo] = api.useLazyGetPostsQuery(options)
483483
```ts no-transpile
484484
type UseLazyQuery = (
485485
options?: UseLazyQueryOptions
486-
) => [UseLazyQueryTrigger, UseQueryStateResult, UseLazyQueryLastPromiseInfo]
486+
) => [UseLazyQueryTrigger, UseLazyQueryStateResult, UseLazyQueryLastPromiseInfo]
487487

488488
type UseLazyQueryOptions = {
489489
pollingInterval?: number
@@ -506,7 +506,7 @@ type UseLazyQueryTrigger<T> = (arg: any, preferCacheValue?: boolean) => Promise<
506506
updateSubscriptionOptions: (options: SubscriptionOptions) () => void // A method used to update the subscription options (eg. pollingInterval)
507507
}
508508

509-
type UseQueryStateResult<T> = {
509+
type UseLazyQueryStateResult<T> = {
510510
// Base query state
511511
originalArgs?: unknown // Arguments passed to the query
512512
data?: T // The latest returned result regardless of trigger arg, if present
@@ -522,6 +522,8 @@ type UseQueryStateResult<T> = {
522522
isFetching: false // Query is currently fetching, but might have data from an earlier request.
523523
isSuccess: false // Query has data from a successful load.
524524
isError: false // Query is currently in an "error" state.
525+
526+
reset: () => void // Resets the lazy query state to its initial uninitialized state. This will also remove the last result from the cache.
525527
}
526528

527529
type UseLazyQueryLastPromiseInfo = {

0 commit comments

Comments
 (0)