diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index f273f67556..d638d4fcf1 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -150,19 +150,20 @@ angular.module("umbraco.directives") //watch for path changes scope.$watch("path", function (newVal, oldVal) { - if(!scope.tree || newVal){ - loadTree(); + + //resetting the path destroys the tree + if(newVal && newVal !== oldVal){ + scope.tree = null; } + }); //watch for active tree changes scope.$watch("activetree", function (newVal, oldVal) { - if(!scope.tree){ - loadTree(); - }else if (newVal && newVal !== oldVal) { + if (newVal && newVal !== oldVal) { + scope.tree = null; //only reload the tree data and Dom if the newval is different from the old one - loadTree(); } }); @@ -176,6 +177,11 @@ angular.module("umbraco.directives") } }); + //When a section is double clicked + scope.$on("tree.clearCache", function (evt, data) { + treeService.clearCache(data.tree); + scope.tree = null; + }); }; } diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js index 427399fbea..b7c1bdda8b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtreeitem.directive.js @@ -140,10 +140,6 @@ angular.module("umbraco.directives") scope.loadChildren(null, scope.node, true); }else if( !node.metaData.treeAlias && activePath.indexOf(node.id) >= 0){ scope.loadChildren(null, scope.node, true); - - scope.path = activePath.filter( function(element) { - return listToDelete.indexOf(obj.id) === -1; - }); } } };