apollo – Is polling automatically paused for a GraphQL query when refetch is called?

I have a React frontend app that communicates with a Neo4j database via a GraphQL Apollo server. The frontend app queries data and renders the first 500 records in a tabular format.

I set this query’s pollInterval to 2 seconds so that it would update the table every 2 seconds.

When the user uses the search bar and search, I would call refetch to re-request data from the database with the search term. (request is a function returned by the GraphQL query custom hook.)

However, refetch might take 5 seconds. During this time, would the pollInterval still be running since its interval is 2 seconds? Or would GraphQL know to pause it?

I couldn’t find anything from the documentations about this. If the answer is yes, this would let me stop the polling while refetch is running to save resources.

Read more here: Source link