@tanstack/react-query 4.32.1 → 4.32.6

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": "4.32.1",
3
+ "version": "4.32.6",
4
4
  "description": "Hooks for managing, caching and syncing asynchronous and remote data in React",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "use-sync-external-store": "^1.2.0",
54
- "@tanstack/query-core": "4.32.1"
54
+ "@tanstack/query-core": "4.32.6"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
@@ -6211,4 +6211,25 @@ describe('useQuery', () => {
6211
6211
  await waitFor(() => rendered.getByText('Rendered Id: 2'))
6212
6212
  expect(spy).toHaveBeenCalledTimes(1)
6213
6213
  })
6214
+ it('should not cause an infinite render loop when using unstable callback ref', async () => {
6215
+ const key = queryKey()
6216
+
6217
+ function Test() {
6218
+ const [_, setRef] = React.useState<HTMLDivElement | null>()
6219
+
6220
+ const { data } = useQuery({
6221
+ queryKey: [key],
6222
+ queryFn: async () => {
6223
+ await sleep(5)
6224
+ return 'Works'
6225
+ },
6226
+ })
6227
+
6228
+ return <div ref={(value) => setRef(value)}>{data}</div>
6229
+ }
6230
+
6231
+ const rendered = renderWithClient(queryClient, <Test />)
6232
+
6233
+ await waitFor(() => rendered.getByText('Works'))
6234
+ })
6214
6235
  })