From 46c1ff8318931c52b170cccf56c4ff52fb4c1b00 Mon Sep 17 00:00:00 2001 From: "David J. Hamilton" Date: Thu, 9 Mar 2017 15:10:51 -0800 Subject: [PATCH] Don't calculate `_changedKeys` pointlessly If the internal model has no record, we won't do anything with the changes, so let's not waste cycles calculating them. --- addon/-private/system/model/internal-model.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/addon/-private/system/model/internal-model.js b/addon/-private/system/model/internal-model.js index 57553a38934..ea025758679 100644 --- a/addon/-private/system/model/internal-model.js +++ b/addon/-private/system/model/internal-model.js @@ -518,9 +518,15 @@ export default class InternalModel { setupData(data) { heimdall.increment(setupData); - let changedKeys = this._changedKeys(data.attributes); + let changedKeys; + + if (this.hasRecord) { + changedKeys = this._changedKeys(data.attributes); + } + assign(this._data, data.attributes); this.pushedData(); + if (this.hasRecord) { this.record._notifyProperties(changedKeys); }