Auto-Cancel Query - Avoid Memory Leaks #137
Unanswered
PhillipNinan
asked this question in
Q&A
Replies: 1 comment
-
It should be destroyed. Can you reproduce it on stackblitz or a repo? |
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
-
hello! I apologize if this is a rookie question. I am new to query and attempting to learn the ropes and all the use cases! Thank you @NetanelBasal and all the other OSS contributors!
I defined a
query
example below. I was toying around with therefetchOnWindowFocus
option. It appears that this query will continue to update once the function is called, even after the component is destroyed. This is great for global state, but what if I want to use local state for a family of components? What if I call this for 100xpeople
? If I have 50 queries will each query continue to refresh?I know I have some options:
removeQueries(...)
clear()
refreshOnXXX: false
enabled: someVariable
Is there any way to automatically clear a query once a component is destroyed? I have some colleagues that use react-query and this doesn't seem to be a problem for them.
Beta Was this translation helpful? Give feedback.
All reactions