mirror of
https://github.com/nasa/openmct.git
synced 2025-06-20 08:03:49 +00:00
[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.
This commit is contained in:
@ -131,22 +131,20 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function changeTemplate(templateUrl) {
|
function changeTemplate(templateUrl) {
|
||||||
if (templateUrl !== activeTemplateUrl) {
|
if (templateUrl) {
|
||||||
if (templateUrl) {
|
addElement();
|
||||||
addElement();
|
self.load(templateUrl).then(function (template) {
|
||||||
self.load(templateUrl).then(function (template) {
|
// Avoid race conditions
|
||||||
// Avoid race conditions
|
if (templateUrl === activeTemplateUrl) {
|
||||||
if (templateUrl === activeTemplateUrl) {
|
populateElement(template);
|
||||||
populateElement(template);
|
}
|
||||||
}
|
}, function () {
|
||||||
}, function () {
|
badTemplate(templateUrl);
|
||||||
badTemplate(templateUrl);
|
});
|
||||||
});
|
} else {
|
||||||
} else {
|
removeElement();
|
||||||
removeElement();
|
|
||||||
}
|
|
||||||
activeTemplateUrl = templateUrl;
|
|
||||||
}
|
}
|
||||||
|
activeTemplateUrl = templateUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (templateUrl) {
|
if (templateUrl) {
|
||||||
|
Reference in New Issue
Block a user