Skip to content

Commit

Permalink
ensure a fetch on mounting for post-list-fetcher
Browse files Browse the repository at this point in the history
This should address stale data that can otherwise be shown in the desktop app.
  • Loading branch information
rralian committed Feb 5, 2016
1 parent 120f485 commit 1161110
Show file tree
Hide file tree
Showing 2 changed files with 5 additions 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: false } );
this._poller = pollers.add( postListStore, actions.fetchUpdated, { interval: 60000 } );
},

componentWillUnmount: function() {
Expand Down
4 changes: 4 additions & 0 deletions client/lib/posts/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,10 @@ PostActions = {

postListStore = postListStoreFactory( postListStoreId );

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

Dispatcher.handleViewAction( {
type: 'FETCH_UPDATED_POSTS',
postListStoreId: postListStoreId
Expand Down

0 comments on commit 1161110

Please sign in to comment.