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
Happens even when
enabled: false
is set in the query optionsWhat happens if you change to static queryKey
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 infiniteIsn't the problem constantly changing the key value
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
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
It shouldn't fetch a million times in the first place
haha