From 11611104c24853fafd3e42926cbb6224d4d14679 Mon Sep 17 00:00:00 2001 From: Bob Ralian Date: Mon, 1 Feb 2016 16:35:26 -0600 Subject: [PATCH] ensure a fetch on mounting for post-list-fetcher This should address stale data that can otherwise be shown in the desktop app. --- client/components/post-list-fetcher/index.jsx | 7 +------ client/lib/posts/actions.js | 4 ++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/client/components/post-list-fetcher/index.jsx b/client/components/post-list-fetcher/index.jsx index ba3fd99eaef5..18509c3e3502 100644 --- a/client/components/post-list-fetcher/index.jsx +++ b/client/components/post-list-fetcher/index.jsx @@ -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 ) { @@ -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() { diff --git a/client/lib/posts/actions.js b/client/lib/posts/actions.js index 3e02c9744bb9..47d8c6668b8e 100644 --- a/client/lib/posts/actions.js +++ b/client/lib/posts/actions.js @@ -480,6 +480,10 @@ PostActions = { postListStore = postListStoreFactory( postListStoreId ); + if ( postListStore.getPage() === 0 ) { + return PostActions.fetchNextPage( postListStoreId ); + } + Dispatcher.handleViewAction( { type: 'FETCH_UPDATED_POSTS', postListStoreId: postListStoreId