Why useQuery runs multiple times?
my first time of using react query and facing issue of running API request multiple times, I dont know what causes this issue
am I doing anything wrong?
8 Replies
I use it in provider
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ohhh okay
Another thing to add is that by default tRPC refetches on window focus & component remount (for queries). This means that whenever you click into another application and go back, it will refetch again, as well as when your component library unmounts and remounts a custom component.
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Huh, didn't know that, I think that relates to the refetch on focus 🙂
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah it works this way for every browser