How to stop useQuery execution #1655
-
I have a site with multiple pages where one of the page has my react component which use useQuery to fetch data and on window focusing on the same page again fetching data. Now when i navigate to other page which doesn't have any react component still on window focus fetch call is trigger which suppose to not. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Not sure I fully understand. If you unmount a component that has Can you try and create a minimal codesandbox example to reproduce your issue please. |
Beta Was this translation helpful? Give feedback.
Not sure I fully understand. If you unmount a component that has
useQuery
, the query will become inactive. No more fetching will go on for that query. It sounds like you have the query still mounted somewhere.Can you try and create a minimal codesandbox example to reproduce your issue please.