Skip to content

Commit

Permalink
Add polling to queries
Browse files Browse the repository at this point in the history
Subscriptions are the goal, since they are likely much more efficient
and scale, but for the purposes of a demo we think that just using built
in polling functionality of ApolloClient will do the trick.

Issue #44
  • Loading branch information
slifty committed Mar 14, 2019
1 parent b1dce9b commit 70446aa
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/client/components/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Dashboard extends React.Component {
after: intervalScope.startTime,
before: intervalScope.endTime,
}}
pollInterval={2000}
>
{({ data, error, loading }) => {
if (loading) {
Expand Down Expand Up @@ -101,6 +102,7 @@ class Dashboard extends React.Component {
<Query
query={RECENT_SENTENCES_QUERY}
variables={{ after: moment().subtract(5, 'minutes').toISOString() }}
pollInterval={2000}
>
{({ data, error, loading }) => {
if (loading) {
Expand Down

0 comments on commit 70446aa

Please sign in to comment.