Fix loadRange doesn't return all posts

This commit is contained in:
Wadim Kalmykov 2020-10-12 13:24:54 +07:00 committed by Alexander Skvortsov
parent d00c932ffc
commit a8c52bc3df

View File

@ -282,7 +282,13 @@ class PostStreamState {
}
});
return loadIds.length ? app.store.find('posts', loadIds) : Promise.resolve(loaded);
if (loadIds.length) {
return app.store.find('posts', loadIds).then((newPosts) => {
return loaded.concat(newPosts).sort((a, b) => a.id() - b.id());
});
}
return Promise.resolve(loaded);
}
/**