From 04594ea5362536a4f8072b4b1f5b8037f9d154aa Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Fri, 30 Oct 2015 15:32:20 -0700 Subject: [PATCH] [Representation] Rebuild scopes on every change Create new scopes on every changeTemplate request, even if the same template is being viewed; presume that we want a new instance of the same template. Avoids scope reuse for cases such as switching from a plot of one object to a plot of another object. --- platform/representation/src/TemplateLinker.js | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/platform/representation/src/TemplateLinker.js b/platform/representation/src/TemplateLinker.js index 9a5e8a67f2..dc19943ed8 100644 --- a/platform/representation/src/TemplateLinker.js +++ b/platform/representation/src/TemplateLinker.js @@ -131,22 +131,20 @@ define( } function changeTemplate(templateUrl) { - if (templateUrl !== activeTemplateUrl) { - if (templateUrl) { - addElement(); - self.load(templateUrl).then(function (template) { - // Avoid race conditions - if (templateUrl === activeTemplateUrl) { - populateElement(template); - } - }, function () { - badTemplate(templateUrl); - }); - } else { - removeElement(); - } - activeTemplateUrl = templateUrl; + if (templateUrl) { + addElement(); + self.load(templateUrl).then(function (template) { + // Avoid race conditions + if (templateUrl === activeTemplateUrl) { + populateElement(template); + } + }, function () { + badTemplate(templateUrl); + }); + } else { + removeElement(); } + activeTemplateUrl = templateUrl; } if (templateUrl) {