Fix post in channel batching order (#4089)

This commit is contained in:
Elias Nahum
2020-03-30 15:02:35 -03:00
committed by GitHub
parent 00a05b1671
commit e6099bcaf8

View File

@@ -84,10 +84,6 @@ export function getPosts(channelId, page = 0, perPage = Posts.POST_CHUNK_SIZE) {
const posts = Object.values(data.posts);
const actions = [];
if (posts?.length || !postForChannel) {
actions.push(receivedPostsInChannel(data, channelId, page === 0, data.prev_post_id === ''));
}
if (posts?.length) {
actions.push(receivedPosts(data));
const additional = await dispatch(getPostsAdditionalDataBatch(posts));
@@ -96,6 +92,10 @@ export function getPosts(channelId, page = 0, perPage = Posts.POST_CHUNK_SIZE) {
}
}
if (posts?.length || !postForChannel) {
actions.push(receivedPostsInChannel(data, channelId, page === 0, data.prev_post_id === ''));
}
dispatch(batchActions(actions));
return {data};