@tanstack/react-query 4.0.11-beta.0 → 4.0.11-beta.5
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/build/lib/index.js +3 -30905
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +2 -30905
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/types.d.ts +3 -4
- package/build/umd/index.development.js +2669 -30071
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +8 -6
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -4
- package/src/__tests__/useQuery.test.tsx +10 -8
- package/src/types.ts +10 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "4.0.11-beta.
|
|
3
|
+
"version": "4.0.11-beta.5",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
"type": "github",
|
|
11
11
|
"url": "https://github.com/sponsors/tannerlinsley"
|
|
12
12
|
},
|
|
13
|
+
"types": "build/lib/index.d.ts",
|
|
13
14
|
"module": "build/lib/index.mjs",
|
|
14
15
|
"main": "build/lib/index.js",
|
|
15
|
-
"browser": "build/umd/index.production.js",
|
|
16
|
-
"types": "build/lib/index.d.ts",
|
|
17
16
|
"exports": {
|
|
18
17
|
".": {
|
|
19
18
|
"types": "./build/lib/index.d.ts",
|
|
@@ -47,7 +46,7 @@
|
|
|
47
46
|
"react-error-boundary": "^3.1.4"
|
|
48
47
|
},
|
|
49
48
|
"dependencies": {
|
|
50
|
-
"@tanstack/query-core": "^4.0.
|
|
49
|
+
"@tanstack/query-core": "^4.0.11-beta.5",
|
|
51
50
|
"@types/use-sync-external-store": "^0.0.3",
|
|
52
51
|
"use-sync-external-store": "^1.2.0"
|
|
53
52
|
},
|
|
@@ -2149,14 +2149,16 @@ describe('useQuery', () => {
|
|
|
2149
2149
|
await sleep(20)
|
|
2150
2150
|
unsubscribe()
|
|
2151
2151
|
|
|
2152
|
-
// 1.
|
|
2153
|
-
// 2.
|
|
2154
|
-
// 3. Observer
|
|
2155
|
-
// 4. Query success
|
|
2156
|
-
// 5. Observer success
|
|
2157
|
-
// 6. Query stale
|
|
2158
|
-
// 7.
|
|
2159
|
-
|
|
2152
|
+
// 1. Query added -> loading
|
|
2153
|
+
// 2. Observer result updated -> loading
|
|
2154
|
+
// 3. Observer added
|
|
2155
|
+
// 4. Query updated -> success
|
|
2156
|
+
// 5. Observer result updated -> success
|
|
2157
|
+
// 6. Query updated -> stale
|
|
2158
|
+
// 7. Observer options updated
|
|
2159
|
+
// 8. Observer result updated -> stale
|
|
2160
|
+
// 9. Observer options updated
|
|
2161
|
+
expect(fn).toHaveBeenCalledTimes(9)
|
|
2160
2162
|
})
|
|
2161
2163
|
|
|
2162
2164
|
it('should not re-render when it should only re-render on data changes and the data did not change', async () => {
|
package/src/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
QueryKey,
|
|
9
9
|
MutationObserverOptions,
|
|
10
10
|
MutateFunction,
|
|
11
|
+
DefinedQueryObserverResult,
|
|
11
12
|
} from '@tanstack/query-core'
|
|
12
13
|
import type { QueryClient } from '@tanstack/query-core'
|
|
13
14
|
|
|
@@ -65,10 +66,15 @@ export type UseQueryResult<
|
|
|
65
66
|
TError = unknown,
|
|
66
67
|
> = UseBaseQueryResult<TData, TError>
|
|
67
68
|
|
|
68
|
-
export type
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
>
|
|
69
|
+
export type DefinedUseBaseQueryResult<
|
|
70
|
+
TData = unknown,
|
|
71
|
+
TError = unknown,
|
|
72
|
+
> = DefinedQueryObserverResult<TData, TError>
|
|
73
|
+
|
|
74
|
+
export type DefinedUseQueryResult<
|
|
75
|
+
TData = unknown,
|
|
76
|
+
TError = unknown,
|
|
77
|
+
> = DefinedUseBaseQueryResult<TData, TError>
|
|
72
78
|
|
|
73
79
|
export type UseInfiniteQueryResult<
|
|
74
80
|
TData = unknown,
|