Skip to content

Commit

Permalink
remove double-fetch when using leading polling
Browse files Browse the repository at this point in the history
When I changed the polling mechanism to run a fetch initially, I found there were two post-list fetches happening at once. It turns out the post-list-fetcher had another mechanism to fetch the initial query, which is to run "fetchNextPage" when we're on page zero. By removing this we should have the initial fetch handled by the polling's leading fetch request.
  • Loading branch information
rralian committed Feb 2, 2016
1 parent 061bd84 commit 151bb2b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions client/components/post-list-fetcher/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ var postListStoreFactory = require( 'lib/posts/post-list-store-factory' ),
var PostListFetcher;

function dispatchQueryActions( postListStoreId, query ) {
var postListStore = postListStoreFactory( postListStoreId );
actions.queryPosts( query, postListStoreId );

if ( postListStore.getPage() === 0 ) {
actions.fetchNextPage( postListStoreId );
}
}

function queryPosts( props ) {
Expand Down Expand Up @@ -126,7 +121,7 @@ PostListFetcher = React.createClass( {

componentDidMount: function() {
var postListStore = postListStoreFactory( this.props.postListStoreId );
this._poller = pollers.add( postListStore, actions.fetchUpdated, { interval: 60000, leading: true } );
this._poller = pollers.add( postListStore, actions.fetchUpdated, { interval: 600000 } );
},

componentWillUnmount: function() {
Expand Down

0 comments on commit 151bb2b

Please sign in to comment.