Skip to content

Commit 2cef448

Browse files
authored
Adjust isLoading/isFetching explanation (#1340)
1 parent 6f0b3f1 commit 2cef448

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/rtk-query/usage/queries.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,10 @@ The auto-generated React hooks created by the React-specific version of `createA
193193

194194
For query endpoints, RTK Query maintains a semantic distinction between `isLoading` and `isFetching` in order to provide more flexibility with the derived information provided.
195195

196-
- `isLoading` refers to a query being in flight for the _first time_ for the given endpoint + query param combination. No data will be available at this time.
197-
- `isFetching` refers to a query being in flight for the given endpoint + query param combination, but not necessarily for the first time. Data may be available from an earlier request at this time.
196+
- `isLoading` refers to a query being in flight for the _first time_ for the given hook. No data will be available at this time.
197+
- `isFetching` refers to a query being in flight for the given endpoint + query param combination, but not necessarily for the first time. Data may be available from an earlier request done by this hook, maybe with the previous query param.
198198

199-
This distinction allows for greater control when handling UI behavior. For example, `isLoading` can be used to display a skeleton while loading for the first time, while `isFetching` can be used to grey out old data when fetching subsequent requests when data is invalidated and re-fetched.
199+
This distinction allows for greater control when handling UI behavior. For example, `isLoading` can be used to display a skeleton while loading for the first time, while `isFetching` can be used to grey out old data when changing from page 1 to page 2 or when data is invalidated and re-fetched.
200200

201201
```tsx title="Managing UI behavior with Query Loading States"
202202
import { Skeleton } from './Skeleton'

0 commit comments

Comments
 (0)