Skip to content

Commit

Permalink
stash
Browse files Browse the repository at this point in the history
  • Loading branch information
runspired committed Jul 27, 2018
1 parent 4b62148 commit 2c40216
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion addon/-legacy-private/system/model/model.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ComputedProperty from '@ember/object/computed';
import { isNone } from '@ember/utils';
import EmberError from '@ember/error';
import run from '@ember/runloop';
import Evented from '@ember/object/evented';
import EmberObject, { computed, get } from '@ember/object';
import Map from '../map';
Expand Down Expand Up @@ -615,7 +616,10 @@ const Model = EmberObject.extend(Evented, {
destroyRecord(options) {
this.deleteRecord();
return this.save(options).then(() => {
this.unloadRecord();
// the nested runloop here is necessary to ensure that the record is fully
// destroyed prior to the promise resolving.
// run.join is inadequate as the destroy queue would still be flushed after the resolve
run(() => this.unloadRecord());
});
},

Expand Down
1 change: 1 addition & 0 deletions tests/integration/records/delete-record-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ module('integration/deletedRecord - Deleting Records', function(hooks) {
await record.destroyRecord();

assert.equal(get(record, 'currentState.stateName'), 'root.deleted.saved', 'We reached the correct persisted saved state');
debugger;
assert.equal(
get(store.peekAll('person'), 'length'),
0,
Expand Down

0 comments on commit 2c40216

Please sign in to comment.