# Dynamic GraphQL polling with React and Apollo Client

DevFeed: [Dynamic GraphQL polling with React and Apollo Client](<https://devfeed.tech/articles/dynamic-graphql-polling-with-react-and-apollo-client-23277.md>)

Original publisher: [Read original article](<https://www.apollographql.com/blog/dynamic-graphql-polling-with-react-and-apollo-client-fb36e390d250>)

Author: David Glasser

Published: 2017-12-05T23:00:12Z

Content type: tutorial

Language: en

Sources: [Apollo Blog](<https://devfeed.tech/sources/apollo-blog.md>)

Topics: [apollo-client](<https://devfeed.tech/topics/apollo-client.md>), [GraphQL](<https://devfeed.tech/topics/graphql.md>), [React](<https://devfeed.tech/topics/react.md>)

Tags: [admin](<https://devfeed.tech/tags/admin.md>), [apollo](<https://devfeed.tech/tags/apollo.md>), [apollo-client](<https://devfeed.tech/tags/apollo-client.md>), [database](<https://devfeed.tech/tags/database.md>), [galaxy](<https://devfeed.tech/tags/galaxy.md>), [graphql](<https://devfeed.tech/tags/graphql.md>), [meteor](<https://devfeed.tech/tags/meteor.md>), [migrations](<https://devfeed.tech/tags/migrations.md>), [poll](<https://devfeed.tech/tags/poll.md>), [query](<https://devfeed.tech/tags/query.md>), [react](<https://devfeed.tech/tags/react.md>), [server](<https://devfeed.tech/tags/server.md>), [ui](<https://devfeed.tech/tags/ui.md>), [update](<https://devfeed.tech/tags/update.md>), [using](<https://devfeed.tech/tags/using.md>)

## AI overview

For a Galaxy admin view that usually has no migrations but needs faster progress updates while one runs, the author describes setting Apollo Client's GraphQL polling interval from query results. In react-apollo, the query options can be a function of component props; a React lifecycle helper can inspect fetched data and adjust the interval. Check the current state before updating it, since setting the same value can still trigger nested component rerenders. The pattern requires react-apollo version 2.0.3 or later because earlier versions had a bug involving changes to the polling interval.

## Source excerpt

I recently added a feature to the admin interface on Meteor Galaxy, Meteor Development Group's hosting platform for Meteor apps, that shows the state of our internal database migrations. I'm using Apollo Client with react-apollo to build Galaxy's UI, and I wanted the control panel to automatically update to show the state of any migrations. To do that, I had to decide how often the GraphQL query would poll our server.