From ddf500b169f80b3149a5738582473a95a877851f Mon Sep 17 00:00:00 2001 From: Brian Sokolnicki Date: Fri, 2 Aug 2019 12:53:50 -0500 Subject: [PATCH] bug fix for array iteration --- .../src/common/services/tree.service.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js index 3e60b09ad9..3c9846fc43 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js @@ -69,12 +69,14 @@ function treeService($q, treeResource, iconHelper, notificationsService, eventsS if (childPath.startsWith(p + ",")) { //this means that the node's path supercedes this path stored so we can remove the current 'p' and replace it with node.path expandedPaths.splice(expandedPaths.indexOf(p), 1); //remove it - expandedPaths.push(childPath); //replace it + if (expandedPaths.indexOf(childPath) === -1) { + expandedPaths.push(childPath); //replace it + } } else if (p.startsWith(childPath + ",")) { //this means we've already tracked a deeper node so we shouldn't track this one } - else { + else if (expandedPaths.indexOf(childPath) === -1) { expandedPaths.push(childPath); //track it } });