useQuery Looping #9167
Unanswered
rikotacards
asked this question in
Q&A
Replies: 1 comment
-
I don’t understand that code-snippet because it’s not showing the full picture. I can take a closer look if you provide a minimal, runnable reproduction in stackblitz or codesandbox. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have an api call that returns an offset value, this value is almost incrementing each time.
I use this hook in other useQueries, for example:
When my component mounts, it will call useUserService();
lets say offset is 1,
when the query state changes from isLoading = true, to false,
This would cause another re-render of my component, which would then cause useUserService() to be called again correct?
and if offset is now 2, the cache has changed, and would cause isLoading = true again ?
and then afterwards, isLoading = false, and so on.
Is my understanding correct here, that the incrementing offset value is causing the loop? and I should just remove it from they query key?
Beta Was this translation helpful? Give feedback.
All reactions