Skip to content

Commit

Permalink
No longer reach into internalModel.record in record-array-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Oct 18, 2016
1 parent 6426c00 commit 35c55f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions addon/-private/system/model/internal-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default function InternalModel(type, id, store, _, data) {
this.recordReference = new RecordReference(store, this);
this.references = {};
this.isReloading = false;
this._isDestroyed = false;
this.isError = false;
this.error = null;
this.__ember_meta__ = null;
Expand Down Expand Up @@ -272,7 +273,12 @@ InternalModel.prototype = {
}
},

get isDestroyed() {
return this._isDestroyed;
},

destroy() {
this._isDestroyed = true;
if (this.record) {
return this.record.destroy();
}
Expand Down
6 changes: 3 additions & 3 deletions addon/-private/system/record-array-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ export default Ember.Object.extend({
updateRecordArrays() {
heimdall.increment(updateRecordArrays);
this.changedRecords.forEach(internalModel => {
if (get(internalModel, 'record.isDestroyed') ||
get(internalModel, 'record.isDestroying') ||
(get(internalModel, 'currentState.stateName') === 'root.deleted.saved')) {

if (internalModel.isDestroyed ||
internalModel.currentState.stateName === 'root.deleted.saved') {
this._recordWasDeleted(internalModel);
} else {
this._recordWasChanged(internalModel);
Expand Down

0 comments on commit 35c55f4

Please sign in to comment.