question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useQuery `pollInterval` stop working in React v18 StrictMode

See original GitHub issue

Intended outcome: pollInterval should work either with React v18 StrictMode or without StrictMode

Actual outcome: pollInterval stop working when using it with React v18 StrictMode

How to reproduce the issue:

  1. Go to https://codesandbox.io/s/heuristic-bohr-df8gf9?file=/src/index.js
  2. Open the dev tools, go to network tab
  3. BUG: There is no new request to the graphql endpoint even though the pollingInterval is set to 2000
  4. If you remove <React.StrictMode> in index.js file, the polling will work as expected.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:33
  • Comments:20

github_iconTop GitHub Comments

12reactions
boyerstcommented, Jun 22, 2022

Experiencing this as well. Manually triggering the poll via startPolling is a workaround

1reaction
angelhodarcommented, Nov 2, 2022

@thiagokpelo Mmmm then i dont understand why it doesnt work in my case. I should try a minimal reproduction example. Thanks for telling me!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

useQuery pollInterval with cache-and-network doesn't stop ...
React Apollo: useQuery pollInterval with cache-and-network doesn't stop to make requests after unmounting the component.
Read more >
Queries - Apollo GraphQL Docs
This article shows how to fetch GraphQL data in React with the useQuery hook and ... Note that if you set pollInterval to...
Read more >
apollo/client
Make queries with a pollInterval respect the no-cache fetch policy, ... Apollo Client v3.6 should no longer prevent you from updating to React...
Read more >
The React + Apollo Tutorial for 2020 (Real-World Examples)
Plus it makes working with React and GraphQL a lot easier by giving us ... graphql-tag is integrated into apollo-boost , but not...
Read more >
@apollo/client | Yarn - Package Manager
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found