From 1ea007bd3a9be580d4233bb68b3bc16e2f0e8318 Mon Sep 17 00:00:00 2001 From: "David J. Hamilton" Date: Fri, 21 Oct 2016 10:14:49 -0700 Subject: [PATCH] feedback better unload --- addon/-private/system/model/internal-model.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/addon/-private/system/model/internal-model.js b/addon/-private/system/model/internal-model.js index 4425b6c4a84..80e224c3468 100644 --- a/addon/-private/system/model/internal-model.js +++ b/addon/-private/system/model/internal-model.js @@ -255,12 +255,21 @@ InternalModel.prototype = { return this.record; }, - directlyRelatedInternalModels() { + /** + Computes the set of internal models reachable from `this` across exactly one + relationship. + + @return {Array} An array containing the internal models that `this` belongs + to or has many. + */ + _directlyRelatedInternalModels() { let array = []; this.type.eachRelationship((key, relationship) => { if (this._relationships.has(key)) { let related = this._relationships.get(key).members.toArray(); - array.push(...related); + for (let i=0; i 0) { let node = queue.shift(); array.push(node); - let related = node.directlyRelatedInternalModels(); + let related = node._directlyRelatedInternalModels(); for (let i=0; i