-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Describe the bug
Dear TanStack Query Team,
I hope this message finds you well. I would like to report an unexpected behavior that occurred suddenly with the useQuery
hook from the @tanstack/react-query library, version "^4.29.19", on my Apple M1 machine running macOS Ventura version 13.4.1 (22F82).
Description:
While working on my application, I suddenly observed that the useQuery
hook was not functioning as expected. The hook kept returning { loading: true }
but data
was undefined
. Moreover, there was no network request being made to the actual API, which I confirmed by checking the Network console in the browser. This behavior occurred suddenly while the useQuery
hook was previously working correctly.
Workaround:
I was able to get useQuery
to work normally again by restarting my laptop. However, this is not an ideal solution and the root cause of the issue remains unknown.
Your minimal, reproducible example
Steps to reproduce
Steps to Reproduce:
- Use @tanstack/react-query library version "^4.29.19" on an Apple M1 machine with macOS Ventura version 13.4.1 (22F82).
- Utilize the
useQuery
hook in a React component to fetch data from an API (note: it might be working fine initially). - Suddenly observe that
useQuery
starts returning{ loading: true }
anddata
asundefined
, without making any network request to the API. - Restart the machine.
- Observe that the
useQuery
hook begins to work normally again after the restart.
Expected behavior
Expected Behavior:
The useQuery
hook should consistently initiate a network request to the desired API and return the data when available.
How often does this bug happen?
Only once
Screenshots or Videos
No response
Platform
Environment:
- Device: Apple M1
- OS: macOS Ventura
- OS Version: 13.4.1 (22F82)
- Library: @tanstack/react-query
- Library Version: "^4.29.19"
- "axios": "^1.4.0",
Tanstack Query adapter
react-query
TanStack Query version
"@tanstack/react-query": "^4.29.19",
TypeScript version
"typescript": "^4.9.5",
Additional context
Additional Information:
This issue appeared suddenly during normal usage, and I did not make any changes to the code or environment that would explain this behavior. It's unclear what may have caused the issue, and why a restart resolved it.
I would greatly appreciate it if your team could investigate this issue to identify the root cause and potentially provide a fix or recommendations on how to prevent this behaviour in the future.
Thank you for your attention to this matter.