dist/globals/ember-data.prod.js in ember-data-source-2.14.8 vs dist/globals/ember-data.prod.js in ember-data-source-2.14.9

- old
+ new

@@ -4,11 +4,11 @@ /*! * @overview Ember Data * @copyright Copyright 2011-2017 Tilde Inc. and contributors. * Portions Copyright 2011 LivingSocial Inc. * @license Licensed under MIT license (see license.js) - * @version 2.14.8 + * @version 2.14.9 */ var loader, define, requireModule, require, requirejs; (function (global) { @@ -3075,10 +3075,17 @@ InternalModel.prototype.destroySync = function destroySync() { if (this._isDematerializing) { this.cancelDestroy(); } this._checkForOrphanedInternalModels(); + if (this.isDestroyed || this.isDestroying) { + return; + } + + // just in-case we are not one of the orphaned, we should still + // still destroy ourselves + this.destroy(); }; InternalModel.prototype._checkForOrphanedInternalModels = function _checkForOrphanedInternalModels() { this._isDematerializing = false; this._scheduledDestroy = null; @@ -10836,19 +10843,20 @@ }, _internalModelForId: function (modelName, id) { var trueId = (0, _coerceId.default)(id); var internalModel = this._internalModelsFor(modelName).get(trueId); - if (!internalModel) { - internalModel = this._buildInternalModel(modelName, trueId); + if (internalModel) { + if (internalModel.hasScheduledDestroy()) { + internalModel.destroySync(); + return this._buildInternalModel(modelName, trueId); + } else { + return internalModel; + } } else { - // if we already have an internalModel, we need to ensure any async teardown is cancelled - // since we want it again. - internalModel.cancelDestroy(); + return this._buildInternalModel(modelName, trueId); } - - return internalModel; }, _internalModelDidReceiveRelationshipData: function (modelName, id, relationshipData) { this._relationshipsPayloads.push(modelName, id, relationshipData); }, _internalModelDestroyed: function (internalModel) { @@ -17777,10 +17785,10 @@ }); define("ember-data/version", ["exports"], function (exports) { "use strict"; exports.__esModule = true; - exports.default = "2.14.8"; + exports.default = "2.14.9"; }); define("ember-inflector", ["module", "exports", "ember", "ember-inflector/lib/system", "ember-inflector/lib/ext/string"], function (module, exports, _ember, _system) { "use strict"; exports.__esModule = true;