From 143a2aa65b0d52449fc7b2f3448539bcbb83dffd Mon Sep 17 00:00:00 2001 From: Erik Erikson Date: Fri, 17 Nov 2017 17:30:15 -0800 Subject: [PATCH] Account for duplicate copies without populating more than once. As a result, populate in place. --- lib/classes/Variables.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/classes/Variables.js b/lib/classes/Variables.js index 337d86ce8..294dd61db 100644 --- a/lib/classes/Variables.js +++ b/lib/classes/Variables.js @@ -99,8 +99,10 @@ class Variables { } else { singleValueToPopulate = this.getValueFromSource(variableString) .then(valueToPopulate => { - if (typeof valueToPopulate === 'object' - && typeof this.populatedObjectReferences[variableString] === 'undefined') { + if (typeof valueToPopulate === 'object') { + if (variableString in this.populatedObjectReferences) { + return this.populatedObjectReferences[variableString]; + } this.populatedObjectReferences[variableString] = valueToPopulate; return this.populateObject(valueToPopulate); } @@ -121,7 +123,7 @@ class Variables { }); return BbPromise.all(allValuesToPopulate).then(() => { if (property !== this.service) { - return this.populateProperty(property); + return this.populateProperty(property, true); } return BbPromise.resolve(property); }); @@ -402,7 +404,7 @@ class Variables { } if (typeof computedValueToPopulate === 'string' && computedValueToPopulate.match(this.variableSyntax)) { - return this.populateProperty(computedValueToPopulate); + return this.populateProperty(computedValueToPopulate, true); } return BbPromise.resolve(computedValueToPopulate); }, valueToPopulate);