summaryrefslogtreecommitdiffstats
path: root/web/react/utils
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/utils')
-rw-r--r--web/react/utils/async_client.jsx13
1 files changed, 10 insertions, 3 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index c8676f45d..45cdf699f 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -521,18 +521,25 @@ export function getPosts(id) {
return;
}
- if (PostStore.getAllPosts(channelId) == null) {
+ const postList = PostStore.getAllPosts(channelId);
+
+ if ($.isEmptyObject(postList) || postList.order.length < Constants.POST_CHUNK_SIZE) {
getPostsPage(channelId, Constants.POST_CHUNK_SIZE);
return;
}
- const latestUpdate = PostStore.getLatestUpdate(channelId);
+ const latestPost = PostStore.getLatestPost(channelId);
+ let latestPostTime = 0;
+
+ if (latestPost != null && latestPost.update_at != null) {
+ latestPostTime = latestPost.create_at;
+ }
callTracker['getPosts_' + channelId] = utils.getTimestamp();
client.getPosts(
channelId,
- latestUpdate,
+ latestPostTime,
(data, textStatus, xhr) => {
if (xhr.status === 304 || !data) {
return;