useQuery endless fetching loop

Somehow my useQuery has gotten itself in an endless loop of fetching the query. Why/how does this happen? It's at around 300 thousand fetches after a minute or so.
7 Replies
niels
nielsOP2y ago
Happens even when enabled: false is set in the query options
rocawear
rocawear2y ago
What happens if you change to static queryKey
niels
nielsOP2y ago
Same thing happens. console.log(query.data) runs infinite But maybe it's not related to useQuery not I think about it. Any console log runs infinite
Sybatron
Sybatron2y ago
Isn't the problem constantly changing the key value
niels
nielsOP2y ago
it looks like the component itself is causing it Im using Shadcn's data table looks like theres some useEffect in that component thats causing my query to fetch infinitely
Sybatron
Sybatron2y ago
isnt the data table just styles tanstack react table also if query.data is always undefined shouldn't you check your query function if it actually works how it's supposed to work it shouldnt just return undefined so many times
niels
nielsOP2y ago
It shouldn't fetch a million times in the first place haha
Want results from more Discord servers?
Add your server