Fix phantom outgoing messages

This bug was caused by a race between indexeddb requests and sending
messages. Order of events to repro was roughly:

1. send async idb request for current message list
2. add new message(s)
3. idb request returns with now incomplete message list
4. message collection gets reset to list from 3, removing messages
added in 2, but not removing their phantom views/dom elements. (bug)
5. send another idb request for current message list
6. idb request returns bearing all messages including those from 2.
7. messages from 2 are added and rendered a second time.

The fix was simply to not remove messages in 4, which means we reuse the
original message model object rather than recreating it in 7.

Fixes #243

// FREEBIE
This commit is contained in:
lilia 2015-07-08 11:50:09 -07:00
parent fa4022a4e3
commit cfc3b8e6a5

View file

@ -259,7 +259,7 @@
},
fetchConversation: function(conversationId) {
var options = {};
var options = {remove: false};
options.index = {
// 'conversation' index on [conversationId, received_at]
name : 'conversation',