Fix: Add handle for Saved Path Hierarchy Head not found

This commit is contained in:
Brenden Harrell committed 2021-08-08 21:52:28 -05:00
1 parent 2855fb6bc5
commit d594a79e25
1 file changed
+8
@@ -329,15 +329,22 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
pathName = rawPath[i][0]
pathType = rawPath[i][1]
pathNode = UI.projects.foundations.spaces.designSpace.workspace.getHierarchyHeadsByCodeNameAndNodeType( pathName, pathType )
// If reference parent is workspace node grab node
if (pathType === "Workspace") {
pathNode = UI.projects.foundations.spaces.designSpace.workspace.workspaceNode
}
// If Hierarchy Head is not located within the workspace abort reconnection
if (pathNode === undefined) {
console.log("[WARN] Abort reconnection saved path head node not found in current workspace", node)
return
}
continue
} else { // Walk through children nodes and find the next node from saved path
pathName = rawPath[i][0]
pathType = rawPath[i][1]
pathNode = getNextNodeFromPath(pathNode, pathName, pathType)
}
}
if (pathNode !== undefined ) {
@@ -347,6 +354,7 @@ function newFoundationsFunctionLibraryUiObjectsFromNodes() {
}
function getNextNodeFromPath(node, pathName, pathType) {
console.log("pathNode", node)
let schemaDocument = getSchemaDocument(node)
let nextNode = undefined
for (let i = 0; i < schemaDocument.childrenNodesProperties.length; i++) {