-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
useQuery causes warning in strict mode #7404
Comments
+1 same here. |
+1 and here |
same here |
Hey, I still have this issue with I though it was fixed here: #6216 Any leads on this issue or a workaround? Thanks 👍 |
From what I can tell by inspecting the cache state, useQuery watches are not being cleaned up when components unmount - it would make sense to me that resolving this would stop the broadcast of cache modifications throwing this error? In my case, navigating back and forth between the same two pages using react router results in an ever growing list of watches for the same two queries. This looks like a memory leak, though I haven't checked to see if there is some other mechanism for gc that happens based on some trigger other than components unmounting. |
+1 |
+1, the same |
The warnings should be silenced with the recent change in #7655. I do want to note though that this doesn't solve the actual issue: |
@jcreighton is there an issue tracking fixing useQuery to be torn down correctly under StrictMode? I hit some unexpected behavior with refetchQueries that was different in dev and prod. |
I'm still seeing this warning sometimes in strict mode at version 3.3.20 |
@dchenk Can you try the beta release ( |
The beta release cleared those warnings for me. |
Installing the beta really helped. When to wait for the release? |
@DennieMello This week! |
@brainkim I'm on version |
@yogesnsamy Try 3.4.5! |
When I wrap my app in <React.StrictMode />, some of my components cause the following warning:
These warning disappear outside of Strict Mode and in production builds (which turn off the StrictMode behavior). The components in question don’t set state or use useEffect. They all use useQuery however.
The warnings disappear when I remove useQuery, i.e. by replacing this:
const { data: { preference = {} } = {} } = useQuery(PREFERENCE)
with an example response, like this:
and leaving the rest of the component unchanged.
I am using
"@apollo/client": "^3.3.2"
This issue was originally reposted in react-apollo repo: apollographql/react-apollo#3635
The text was updated successfully, but these errors were encountered: