So I have a subscription to “Posts” and I’m retrieving the array using
Posts.find({},{sort:{createdAt:-1});
I input information into the Collection using this method
Meteor.methods({
new_post: function(text) {
if (! this.userId) {
throw new Meteor.Error('not-authorized');
}
Posts.insert({
users_userid:Meteor.user().id,
text:text,
createdAt: new Date()
});
}
});
and calling it like so:
Meteor.call("new_post", text);
I’m using {{#each Posts}}{{>post}}{{/each}}
spacebars to load it in.
Should work all fine and dandy right? Upon creating a post, it inserts the value into the collection and it renders in the browser… but in the wrong order… Then when I refresh the browser it orders it correctly. What the heck? Is this a bug or do I need to force it to re-render the whole thing somehow?
EDIT:
I have absolutely no idea why but it’s fixed itself… I haven’t modified my code at all… Uh, I guess close this?