-
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 pollInterval
stop working in React v18 StrictMode
#9819
Comments
+1 Seeing the same issue and confirmed that step 4 worked, but not an ideal solution |
Experiencing this as well. Manually triggering the poll via startPolling is a workaround |
I am experiencing this as well. |
Same here! |
+1! |
Experiencing the same. |
Same here 🥲 |
Same here, I have to pass refetch around. Any idea if this will be fixed soon? |
Same here too! 😢 |
Same, in my case its not working even if i call startPolling manually in useEffect. I have also set reactStrictMode to false in next.config.js and it doesnt solve the issue |
If I set |
@thiagokpelo Mmmm then i dont understand why it doesnt work in my case. I should try a minimal reproduction example. Thanks for telling me!! |
@angelhodar will update us here if it resolves. If I can help just say! 👊 |
@thiagokpelo I dont know what i am doing wrong but with a fresh nextjs project and the last version of apollo client i cant get the poll interval to work. What versions did you use to debug your nextjs project? I have tried to manually poll with startPolling and disable reactStrictMode to false and still doesnt work |
Same issue here. Next js with strict mode disabled and still not working |
@angelhodar I'm using "dependencies": {
"@apollo/client": "^3.7.0",
"@chakra-ui/react": "^2.3.5",
"@datadog/browser-logs": "^4.21.2",
"@datadog/browser-rum": "^4.21.2",
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@react-oauth/google": "^0.2.8",
"apollo-link-rest": "^0.9.0-rc.1",
"framer-motion": "^6",
"graphql": "^16.6.0",
"graphql-ws": "^5.11.2",
"next": "12.3.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-intl": "^6.1.2"
} Have you tried to run the built project and with |
Same issue here. Maybe it is dedicated to local Nextjs server |
We are experiencing the same issue at https://github.com/ExpressLRS/ExpressLRS-Configurator |
I had the same issue using Using a timer fixed the issue temporary. Example of the fix:
|
I stumbled in this issue as well. |
The same issue with |
@IShinkarenko You probably did that but make sure you restart (shutdown and start) the Next.JS server. |
Similar issue with @apollo/client@^3.7.3 and next@13.1.1 (just updated) Using the following temp fix as others have suggested: const {
data: indexQuery,
error: indexError,
startPolling,
} = useQuery(IndexDocument, {
ssr: false,
// The following line is removed
// pollInterval: 500,
});
// The following useEffect is added
useEffect(() => {
startPolling(500);
}, [startPolling]); |
I tried version 3.7.4 but this seems to still be an issue - is they any idea as when this will be fixed ? |
|
@mysticek I think this is closely related to #10540 (comment) the workaround suggested there worked for polling too (which is similar to what @ramblehead did) Hopefully, we find a good way to fix this soon 😊 |
This is fixed in #10629 and will hopefully land in the next patch release. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Intended outcome:
pollInterval
should work either with React v18 StrictMode or without StrictModeActual outcome:
pollInterval
stop working when using it with React v18 StrictModeHow to reproduce the issue:
pollingInterval
is set to2000
<React.StrictMode>
inindex.js
file, the polling will work as expected.The text was updated successfully, but these errors were encountered: