@tanstack/react-query 5.24.6 → 5.24.7
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "5.24.
|
|
3
|
+
"version": "5.24.7",
|
|
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.24.
|
|
44
|
+
"@tanstack/query-core": "5.24.7"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^18.2.55",
|
|
@@ -1185,6 +1185,56 @@ describe('useQueries', () => {
|
|
|
1185
1185
|
expect(results.length).toBe(length)
|
|
1186
1186
|
})
|
|
1187
1187
|
|
|
1188
|
+
it('should synchronously track properties of all observer even if a property (isLoading) is only accessed on one observer (#7000)', async () => {
|
|
1189
|
+
const key = queryKey()
|
|
1190
|
+
const ids = [1, 2]
|
|
1191
|
+
|
|
1192
|
+
function Page() {
|
|
1193
|
+
const { isLoading } = useQueries({
|
|
1194
|
+
queries: ids.map((id) => ({
|
|
1195
|
+
queryKey: [key, id],
|
|
1196
|
+
queryFn: () => {
|
|
1197
|
+
return new Promise<{
|
|
1198
|
+
id: number
|
|
1199
|
+
title: string
|
|
1200
|
+
}>((resolve, reject) => {
|
|
1201
|
+
if (id === 2) {
|
|
1202
|
+
setTimeout(() => {
|
|
1203
|
+
reject(new Error('FAILURE'))
|
|
1204
|
+
}, 10)
|
|
1205
|
+
}
|
|
1206
|
+
setTimeout(() => {
|
|
1207
|
+
resolve({ id, title: `Post ${id}` })
|
|
1208
|
+
}, 10)
|
|
1209
|
+
})
|
|
1210
|
+
},
|
|
1211
|
+
retry: false,
|
|
1212
|
+
})),
|
|
1213
|
+
combine: (results) => {
|
|
1214
|
+
// this tracks data on all observers
|
|
1215
|
+
void results.forEach((result) => result.data)
|
|
1216
|
+
return {
|
|
1217
|
+
// .some aborts early, so `isLoading` might not be accessed (and thus tracked) on all observers
|
|
1218
|
+
// leading to missing re-renders
|
|
1219
|
+
isLoading: results.some((result) => result.isLoading),
|
|
1220
|
+
}
|
|
1221
|
+
},
|
|
1222
|
+
})
|
|
1223
|
+
|
|
1224
|
+
return (
|
|
1225
|
+
<div>
|
|
1226
|
+
<p>Loading Status: {isLoading ? 'Loading...' : 'Loaded'}</p>
|
|
1227
|
+
</div>
|
|
1228
|
+
)
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
const rendered = renderWithClient(queryClient, <Page />)
|
|
1232
|
+
|
|
1233
|
+
await waitFor(() => rendered.getByText('Loading Status: Loading...'))
|
|
1234
|
+
|
|
1235
|
+
await waitFor(() => rendered.getByText('Loading Status: Loaded'))
|
|
1236
|
+
})
|
|
1237
|
+
|
|
1188
1238
|
it('should not have stale closures with combine (#6648)', async () => {
|
|
1189
1239
|
const key = queryKey()
|
|
1190
1240
|
|