useQuery calling API twice for the first page load.
I am using react v17 and I am facing this issue whenever the component is rendered for the first time. I have set the staleTime to Infinity and refetchonmount to 'always'. So when I referesh the page, it sends an API call and then it sends another API call. The workaround that we did is to cal refetch inside the useEffect and set the enabled to false for that query.
1 Reply
fascinating-indigo•3y ago
show a reproduction please