You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{#each model.conversation.messages as |message|}}
{{app-message message=message currentUser=session.uid owner=message.owner.id}}
{{/each}}
When i add a message to the conversation, all works fine. But if i reload the page or connect as another user , i see the new message but message.owner.id is null.
This is the code that save the message
send : function(conversation) {
var that = this;
var controller = this.controllerFor('conversation');
this.store.findRecord('user', that.get('session').get('uid')).then(function(user) {
var message = that.store.createRecord('message', {
content : controller.get('message'),
conversation : conversation,
owner : user
});
conversation.get('messages').pushObject(message);
message.save().then(function() {
conversation.save();
});
});
}
Any idea?
The text was updated successfully, but these errors were encountered:
I think ember-data may be overwriting the message.owner shortly after loading the message. Sometimes when ember-data thinks there is an inverse relationship (in your case user.messages), it sees that it is empty and deletes the other side of your relationship. A similar thing was happening in the emberfire demo app.
It is annoying, and it seems some change in ember-data recently has caused this to happen more often.
Note: I am guessing at this point, setting the inverse to null will help us confirm if something similar is happening here.
No better luck. Problem is still here. If I leave the conversation and comes back again, message.owner is filled. The problem appears just on the page reload.
Hi, maybe it's related to this #364. I don't know.
So I have two model with a belongsTo relationship like this :
and
In my template i test this case like this :
When i add a message to the conversation, all works fine. But if i reload the page or connect as another user , i see the new message but message.owner.id is null.
This is the code that save the message
Any idea?
The text was updated successfully, but these errors were encountered: