Sort included posts

They can be out of order in the payload due to relationship loading,
e.g. post #1 includes post #14 that has mentioned it, therefore #14
will be the first post in the payload. The new post stream doesn’t take
kindly to out of order posts.
This commit is contained in:
Toby Zerner 2015-05-29 18:55:19 +09:30
parent 2e82fb4015
commit 456af4273b

View File

@ -82,6 +82,7 @@ export default class DiscussionPage extends mixin(Component, evented) {
includedPosts.push(app.store.getById('posts', record.id));
}
});
includedPosts.sort((a, b) => a.id() - b.id());
this.stream = new PostStream({ discussion, includedPosts });
this.stream.on('positionChanged', this.positionChanged.bind(this));