Answer the question
In order to leave comments, you need to log in
How to know if a linked object is loaded into ember local storage?
The question is, there is a user model, there is an avatar model. I'm trying to delete a user and I don't know if their avatar is loaded. If it is loaded, it must also be deleted from the local storage, and if not, then simply do not touch it, the server will delete it itself.
The problem is that I don't know if the avatar is loaded in advance, if it is loaded, everything is deleted normally, if not .. then an error occurs, because I delete an object that does not exist.
if(user.get('ava').content (как проверить, надо ли ее удалять?)){
user.get('ava').content.destroyRecord()
}
user.destroyRecord();
Answer the question
In order to leave comments, you need to log in
will show the raw data of the ava field, it is either null, or an object, or a number
will return the model if it was loaded, or nullstore.getById('ava', user.get('data.ava'));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question