From 1bdb42b67e36d99268babe08ea3439bca1162530 Mon Sep 17 00:00:00 2001 From: lilia <liliakai@gmail.com> Date: Wed, 18 Feb 2015 15:07:07 -0800 Subject: [PATCH] Fix bug loading conversation upsidedown Sometimes a conversation's messages would be reverse-ordered on first load, correcting themselves after a refresh. This is an artifact of the order we load messages from the database. To fix, load them in the opposite order. The alternative solution would be to reset the collection every time we fetch new messages, but this would create an entirely new set of model objects each time, which seems unnecessary. --- js/models/messages.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/js/models/messages.js b/js/models/messages.js index 1208b7b594..2b48f79849 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -72,8 +72,7 @@ // 'conversation' index on [conversationId, received_at] name : 'conversation', lower : [conversationId], - upper : [conversationId, Number.MAX_VALUE], - order : 'desc' + upper : [conversationId, Number.MAX_VALUE] // SELECT messages WHERE conversationId = this.id ORDER // received_at DESC };