hi , i’m facing a little error trying to refresh a message observable, so the 3 or 4 frist data comes blank and then the value become to come normally, data are coming from parse
var messagesData = Observable()
function Message(from, time, message) {
this.from = from;
this.time = time;
this.message = message;
}
loadMessage()
function loadMessage(){
var roomsQuery = new Parse.Query("ChatRooms")
roomsQuery.equalTo("objectId", rooms.value)
var messagesQuery = new Parse.Query("Messages")
roomsQuery.first({
success: function(results){
messagesQuery.equalTo("channel", results)
messagesQuery.find().then(function(results){
messagesData.refreshAll(results,
function(oldItem, newItem){ return oldItem.id === newItem.id; },
function (newItem){
return messagesData.add(new Message(newItem.get("sender"), newItem.get("createdAt"), newItem.get("message")))
}
)
})
},
error: function(results, error){
console.log(error.message)
}
})
}
i tried to find by my self how to fix this without results, i also have an another question , how can i separate in ui , message come from one user or another depending on their id?
the message comes normally in the console , the probleme is when the view update i have 3 or 4 message blank before the view begin to show something. toString did anything. i have the same problem with almost all my function that call refreshAll
I have to little of your code to reproduce this issue, are you able to share the whole project? Feel free to upload to this dropbox https://www.dropbox.com/request/ZgndLtJQm5eGzG9cicGK if you dont wont to share the project publicly