@tanstack/react-query 4.7.1 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/build/umd/index.development.js +9 -6
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +10 -10
- package/src/__tests__/useInfiniteQuery.test.tsx +30 -50
- package/src/__tests__/useQuery.test.tsx +18 -31
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Tanner Linsley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -2504,12 +2504,15 @@
|
|
|
2504
2504
|
}
|
|
2505
2505
|
|
|
2506
2506
|
const isFetching = fetchStatus === 'fetching';
|
|
2507
|
+
const isLoading = status === 'loading';
|
|
2508
|
+
const isError = status === 'error';
|
|
2507
2509
|
const result = {
|
|
2508
2510
|
status,
|
|
2509
2511
|
fetchStatus,
|
|
2510
|
-
isLoading
|
|
2512
|
+
isLoading,
|
|
2511
2513
|
isSuccess: status === 'success',
|
|
2512
|
-
isError
|
|
2514
|
+
isError,
|
|
2515
|
+
isInitialLoading: isLoading && isFetching,
|
|
2513
2516
|
data,
|
|
2514
2517
|
dataUpdatedAt,
|
|
2515
2518
|
error,
|
|
@@ -2518,13 +2521,13 @@
|
|
|
2518
2521
|
errorUpdateCount: state.errorUpdateCount,
|
|
2519
2522
|
isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
|
|
2520
2523
|
isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
2521
|
-
isFetching
|
|
2522
|
-
isRefetching: isFetching &&
|
|
2523
|
-
isLoadingError:
|
|
2524
|
+
isFetching,
|
|
2525
|
+
isRefetching: isFetching && !isLoading,
|
|
2526
|
+
isLoadingError: isError && state.dataUpdatedAt === 0,
|
|
2524
2527
|
isPaused: fetchStatus === 'paused',
|
|
2525
2528
|
isPlaceholderData,
|
|
2526
2529
|
isPreviousData,
|
|
2527
|
-
isRefetchError:
|
|
2530
|
+
isRefetchError: isError && state.dataUpdatedAt !== 0,
|
|
2528
2531
|
isStale: isStale(query, options),
|
|
2529
2532
|
refetch: this.refetch,
|
|
2530
2533
|
remove: this.remove
|