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
niels12mo ago
Happens even when enabled: false is set in the query options
rocawear
rocawear12mo ago
What happens if you change to static queryKey
niels
niels12mo 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
Sybatron12mo ago
Isn't the problem constantly changing the key value
niels
niels12mo 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
Sybatron12mo 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
niels12mo ago
It shouldn't fetch a million times in the first place haha