@tanstack/react-query 5.27.2 → 5.27.4
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/package.json +2 -2
- package/src/__tests__/useQuery.test.tsx +11 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "5.27.
|
|
3
|
+
"version": "5.27.4",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"!build/codemods/**/__tests__"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@tanstack/query-core": "5.27.
|
|
44
|
+
"@tanstack/query-core": "5.27.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^18.2.55",
|
|
@@ -1223,7 +1223,7 @@ describe('useQuery', () => {
|
|
|
1223
1223
|
data: undefined,
|
|
1224
1224
|
isFetching: false,
|
|
1225
1225
|
isSuccess: false,
|
|
1226
|
-
isStale:
|
|
1226
|
+
isStale: false,
|
|
1227
1227
|
})
|
|
1228
1228
|
})
|
|
1229
1229
|
|
|
@@ -1248,7 +1248,7 @@ describe('useQuery', () => {
|
|
|
1248
1248
|
React.useEffect(() => {
|
|
1249
1249
|
setActTimeout(() => {
|
|
1250
1250
|
queryClient.invalidateQueries({ queryKey: key })
|
|
1251
|
-
},
|
|
1251
|
+
}, 10)
|
|
1252
1252
|
}, [])
|
|
1253
1253
|
|
|
1254
1254
|
return null
|
|
@@ -1256,14 +1256,14 @@ describe('useQuery', () => {
|
|
|
1256
1256
|
|
|
1257
1257
|
renderWithClient(queryClient, <Page />)
|
|
1258
1258
|
|
|
1259
|
-
await sleep(
|
|
1259
|
+
await sleep(50)
|
|
1260
1260
|
|
|
1261
1261
|
expect(states.length).toBe(1)
|
|
1262
1262
|
expect(states[0]).toMatchObject({
|
|
1263
1263
|
data: undefined,
|
|
1264
1264
|
isFetching: false,
|
|
1265
1265
|
isSuccess: false,
|
|
1266
|
-
isStale:
|
|
1266
|
+
isStale: false,
|
|
1267
1267
|
})
|
|
1268
1268
|
})
|
|
1269
1269
|
|
|
@@ -3778,9 +3778,9 @@ describe('useQuery', () => {
|
|
|
3778
3778
|
<div>
|
|
3779
3779
|
<div>FetchStatus: {query.fetchStatus}</div>
|
|
3780
3780
|
<h2>Data: {query.data || 'no data'}</h2>
|
|
3781
|
-
{
|
|
3781
|
+
{shouldFetch ? null : (
|
|
3782
3782
|
<button onClick={() => setShouldFetch(true)}>fetch</button>
|
|
3783
|
-
)
|
|
3783
|
+
)}
|
|
3784
3784
|
</div>
|
|
3785
3785
|
)
|
|
3786
3786
|
}
|
|
@@ -3951,7 +3951,8 @@ describe('useQuery', () => {
|
|
|
3951
3951
|
expect(results.length).toBe(3)
|
|
3952
3952
|
expect(results[0]).toMatchObject({ data: 'initial', isStale: true })
|
|
3953
3953
|
expect(results[1]).toMatchObject({ data: 'fetched data', isStale: true })
|
|
3954
|
-
|
|
3954
|
+
// disabled observers are not stale
|
|
3955
|
+
expect(results[2]).toMatchObject({ data: 'fetched data', isStale: false })
|
|
3955
3956
|
})
|
|
3956
3957
|
|
|
3957
3958
|
it('it should support enabled:false in query object syntax', async () => {
|
|
@@ -4886,14 +4887,14 @@ describe('useQuery', () => {
|
|
|
4886
4887
|
isPending: true,
|
|
4887
4888
|
isFetching: false,
|
|
4888
4889
|
isSuccess: false,
|
|
4889
|
-
isStale:
|
|
4890
|
+
isStale: false,
|
|
4890
4891
|
})
|
|
4891
4892
|
expect(states[1]).toMatchObject({
|
|
4892
4893
|
data: undefined,
|
|
4893
4894
|
isPending: true,
|
|
4894
4895
|
isFetching: true,
|
|
4895
4896
|
isSuccess: false,
|
|
4896
|
-
isStale:
|
|
4897
|
+
isStale: false,
|
|
4897
4898
|
})
|
|
4898
4899
|
expect(states[2]).toMatchObject({
|
|
4899
4900
|
data: 1,
|
|
@@ -4907,7 +4908,7 @@ describe('useQuery', () => {
|
|
|
4907
4908
|
isPending: true,
|
|
4908
4909
|
isFetching: false,
|
|
4909
4910
|
isSuccess: false,
|
|
4910
|
-
isStale:
|
|
4911
|
+
isStale: false,
|
|
4911
4912
|
})
|
|
4912
4913
|
})
|
|
4913
4914
|
|