@tanstack/react-query 5.15.4 → 5.15.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/react-query",
|
|
3
|
-
"version": "5.15.
|
|
3
|
+
"version": "5.15.5",
|
|
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.15.
|
|
44
|
+
"@tanstack/query-core": "5.15.5"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/react": "^18.2.45",
|
|
@@ -1027,6 +1027,46 @@ describe('useQueries', () => {
|
|
|
1027
1027
|
expect(resultChanged).toBe(1)
|
|
1028
1028
|
})
|
|
1029
1029
|
|
|
1030
|
+
it('should only call combine with query results', async () => {
|
|
1031
|
+
const key1 = queryKey()
|
|
1032
|
+
const key2 = queryKey()
|
|
1033
|
+
|
|
1034
|
+
function Page() {
|
|
1035
|
+
const result = useQueries({
|
|
1036
|
+
queries: [
|
|
1037
|
+
{
|
|
1038
|
+
queryKey: key1,
|
|
1039
|
+
queryFn: async () => {
|
|
1040
|
+
await sleep(5)
|
|
1041
|
+
return Promise.resolve('query1')
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
queryKey: key2,
|
|
1046
|
+
queryFn: async () => {
|
|
1047
|
+
await sleep(20)
|
|
1048
|
+
return Promise.resolve('query2')
|
|
1049
|
+
},
|
|
1050
|
+
},
|
|
1051
|
+
],
|
|
1052
|
+
combine: ([query1, query2]) => {
|
|
1053
|
+
return {
|
|
1054
|
+
data: { query1: query1.data, query2: query2.data },
|
|
1055
|
+
}
|
|
1056
|
+
},
|
|
1057
|
+
})
|
|
1058
|
+
|
|
1059
|
+
return <div>data: {JSON.stringify(result)}</div>
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
const rendered = renderWithClient(queryClient, <Page />)
|
|
1063
|
+
await waitFor(() =>
|
|
1064
|
+
rendered.getByText(
|
|
1065
|
+
'data: {"data":{"query1":"query1","query2":"query2"}}',
|
|
1066
|
+
),
|
|
1067
|
+
)
|
|
1068
|
+
})
|
|
1069
|
+
|
|
1030
1070
|
it('should track property access through combine function', async () => {
|
|
1031
1071
|
const key1 = queryKey()
|
|
1032
1072
|
const key2 = queryKey()
|