3
votes

I'm having trouble debugging this error I'm getting while deleting a record. I have a CartItem model that's used as part of a shopping cart.

When I delete the record and persist the change:

cartItem.deleteRecord()
cartItem.save()

This error is raised in the console:

Attempted to handle event becameError on MyApp.CartItem:ember1606:null while in state rootState.deleted.inFlight. Called with undefined

I'm using Ember 1.0 and ember-data 0.13. I've been reading the ember-data source, and I would just like some tips on how to debug this.

1
Could you try with the latest ember-data ? I think this issue is now resolved. - sly7_7
I can't try with the latest ember-data right now, because this is connected to a large app that relies on a lot of old ember data functionality. I did try using ember-data 0.14 and saw the same behavior. - nnyby
Ok. So first question, it seems weird the server respond something like an error response on delete. I don't know what do you respond to DELETE, but I think it should be a 200 with an empty payload. - sly7_7
That's what I figured too - that the server was giving an error on delete. But in fact the cart item is deleted successfully - the server is giving back a 200 with an empty payload. - nnyby
Does the same error happen if you try to commit with the store or a transaction instead of calling save ? Also, are you sure no other action is happening on the record before the server respond ? - sly7_7

1 Answers

0
votes

I'm fairly sure that in old versions of Ember Data that you'd want to use cartItem.get('store').deletedRecord(cartItem) instead of cartItem.deletedRecord() and cartItem.get('store').commit() instead of cartItem.save().