I am running up against this, understandable, behavior from the store.
"Assertion Failed: 'some-record' was saved to the server, but
the response returned the new id '32', which has already
been used with another record.'"
My API supports soft deletes. For complicated business logic reasons, if we recreate a record and it’s the exact same (for our purposes) as the old record that was deleted, we reactivate the old/deleted record rather than create a new one.
I am seeing the error above when I delete a record (soft delete), and then recreate the record. The record is being reactivated with the same id.
As far as my users and API are concerned, there is no issue with reusing the same id and reviving a previously deleted record.
Unfortunately, Ember does not seem to like that behavior. From what I understand, the store is complaining because it thinks I am creating a record and reusing an old id, but really I am reviving the old, deleted, record.
Is there any way to totally purge a record from the store to free up that id? Or is there a better way to handle soft deleted records in Ember?
I tried unloadRecord
, but that does not seem to do the job. I still see that issue so it would seem the id
is still being referenced somehow by the store.