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.
This commit is contained in:
lilia 2015-02-18 15:07:07 -08:00
parent 296dae544d
commit 1bdb42b67e

View file

@ -72,8 +72,7 @@
// 'conversation' index on [conversationId, received_at] // 'conversation' index on [conversationId, received_at]
name : 'conversation', name : 'conversation',
lower : [conversationId], lower : [conversationId],
upper : [conversationId, Number.MAX_VALUE], upper : [conversationId, Number.MAX_VALUE]
order : 'desc'
// SELECT messages WHERE conversationId = this.id ORDER // SELECT messages WHERE conversationId = this.id ORDER
// received_at DESC // received_at DESC
}; };