Ember Data: isDeleted has not changed on record but has changed in record.currentState

594 views Asked by At

Using Ember 1.3.0-beta.4 and Ember Data 1.0.0-beta.4.

I am attempting to delete a record with a simple deleteRecord() call. However, when I fire save() on the record, it executes a PUT instead of a DELETE.

record.deleteRecord();
record.save();

Executes a PUT.

It turns out isDeleted is being improperly set somehow. Or perhaps it is never changed.

record.get('isDeleted'); // false
record.get('isDirty');   // false
record.deleteRecord();
record.get('isDeleted'); // false
record.get('isDirty');   // true

However the currentState DOES appear to have changed.

record.deleteRecord();
record.get('isDeleted');              // false
record.get('currentState.isDeleted'); // true
record.get('currentState.stateName'); // "root.deleted.uncommitted"

Other records delete as normal. Rarely (1 in 10) this code behaves as expected which leads me to believe this is a sequencing issue.

Is there any reason, deleting a record would behave this way?

0

There are 0 answers