@tanstack/react-query 5.0.0-beta.31 → 5.0.0-beta.35
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1695132335995" clover="3.2.0">
|
|
3
|
+
<project timestamp="1695132335995" name="All files">
|
|
4
4
|
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
|
|
5
5
|
</project>
|
|
6
6
|
</coverage>
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
87
87
|
Code coverage generated by
|
|
88
88
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
89
|
-
at 2023-09-
|
|
89
|
+
at 2023-09-19T14:05:35.966Z
|
|
90
90
|
</div>
|
|
91
91
|
<script src="prettify.js"></script>
|
|
92
92
|
<script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.35",
|
|
4
4
|
"description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"client-only": "0.0.1",
|
|
45
|
-
"@tanstack/query-core": "5.0.0-beta.
|
|
45
|
+
"@tanstack/query-core": "5.0.0-beta.35"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/react": "^18.2.4",
|
|
@@ -1154,7 +1154,6 @@ describe('useQuery', () => {
|
|
|
1154
1154
|
|
|
1155
1155
|
it('should update query stale state and refetch when invalidated with invalidateQueries', async () => {
|
|
1156
1156
|
const key = queryKey()
|
|
1157
|
-
const states: Array<UseQueryResult<number>> = []
|
|
1158
1157
|
let count = 0
|
|
1159
1158
|
|
|
1160
1159
|
function Page() {
|
|
@@ -1166,11 +1165,8 @@ describe('useQuery', () => {
|
|
|
1166
1165
|
return count
|
|
1167
1166
|
},
|
|
1168
1167
|
staleTime: Infinity,
|
|
1169
|
-
notifyOnChangeProps: 'all',
|
|
1170
1168
|
})
|
|
1171
1169
|
|
|
1172
|
-
states.push(state)
|
|
1173
|
-
|
|
1174
1170
|
return (
|
|
1175
1171
|
<div>
|
|
1176
1172
|
<button
|
|
@@ -1178,47 +1174,24 @@ describe('useQuery', () => {
|
|
|
1178
1174
|
>
|
|
1179
1175
|
invalidate
|
|
1180
1176
|
</button>
|
|
1181
|
-
data: {state.data}
|
|
1177
|
+
data: {state.data}, isStale: {String(state.isStale)}, isFetching:{' '}
|
|
1178
|
+
{String(state.isFetching)}
|
|
1182
1179
|
</div>
|
|
1183
1180
|
)
|
|
1184
1181
|
}
|
|
1185
1182
|
|
|
1186
1183
|
const rendered = renderWithClient(queryClient, <Page />)
|
|
1187
1184
|
|
|
1188
|
-
await waitFor(() =>
|
|
1185
|
+
await waitFor(() =>
|
|
1186
|
+
rendered.getByText('data: 1, isStale: false, isFetching: false'),
|
|
1187
|
+
)
|
|
1189
1188
|
fireEvent.click(rendered.getByRole('button', { name: /invalidate/i }))
|
|
1190
|
-
await waitFor(() =>
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
isFetching: true,
|
|
1197
|
-
isRefetching: false,
|
|
1198
|
-
isSuccess: false,
|
|
1199
|
-
isStale: true,
|
|
1200
|
-
})
|
|
1201
|
-
expect(states[1]).toMatchObject({
|
|
1202
|
-
data: 1,
|
|
1203
|
-
isFetching: false,
|
|
1204
|
-
isRefetching: false,
|
|
1205
|
-
isSuccess: true,
|
|
1206
|
-
isStale: false,
|
|
1207
|
-
})
|
|
1208
|
-
expect(states[2]).toMatchObject({
|
|
1209
|
-
data: 1,
|
|
1210
|
-
isFetching: true,
|
|
1211
|
-
isRefetching: true,
|
|
1212
|
-
isSuccess: true,
|
|
1213
|
-
isStale: true,
|
|
1214
|
-
})
|
|
1215
|
-
expect(states[3]).toMatchObject({
|
|
1216
|
-
data: 2,
|
|
1217
|
-
isFetching: false,
|
|
1218
|
-
isRefetching: false,
|
|
1219
|
-
isSuccess: true,
|
|
1220
|
-
isStale: false,
|
|
1221
|
-
})
|
|
1189
|
+
await waitFor(() =>
|
|
1190
|
+
rendered.getByText('data: 1, isStale: true, isFetching: true'),
|
|
1191
|
+
)
|
|
1192
|
+
await waitFor(() =>
|
|
1193
|
+
rendered.getByText('data: 2, isStale: false, isFetching: false'),
|
|
1194
|
+
)
|
|
1222
1195
|
})
|
|
1223
1196
|
|
|
1224
1197
|
it('should not update disabled query when refetched with refetchQueries', async () => {
|