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.jsx5
1 files changed, 4 insertions, 1 deletions
diff --git a/web/react/utils/async_client.jsx b/web/react/utils/async_client.jsx
index 8a1ff129d..dc4fc1096 100644
--- a/web/react/utils/async_client.jsx
+++ b/web/react/utils/async_client.jsx
@@ -285,7 +285,10 @@ module.exports.getPosts = function(force, id, maxPosts) {
// if we already have more than POST_CHUNK_SIZE posts,
// let's get the amount we have but rounded up to next multiple of POST_CHUNK_SIZE,
// with a max at maxPosts
- var numPosts = post_list && post_list.order.length > 0 ? Math.min(maxPosts, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE)) : Constants.POST_CHUNK_SIZE;
+ var numPosts = Math.min(maxPosts, Constants.POST_CHUNK_SIZE);
+ if (post_list && post_list.order.length > 0) {
+ numPosts = Math.min(maxPosts, Constants.POST_CHUNK_SIZE * Math.ceil(post_list.order.length / Constants.POST_CHUNK_SIZE));
+ }
if (channelId != null) {
callTracker["getPosts_"+channelId] = utils.getTimestamp();