From c08f67f40dc560e80475b545ff10a29a0816428f Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Thu, 20 Feb 2020 18:29:25 +0100 Subject: [PATCH] Bug fixes --- DesignSpace/Workspace/FunctionLibraries/ChainAttachDetach.js | 1 + .../Workspace/FunctionLibraries/ReferenceAttachDetach.js | 3 +++ DesignSpace/Workspace/Workspace.js | 4 ++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DesignSpace/Workspace/FunctionLibraries/ChainAttachDetach.js b/DesignSpace/Workspace/FunctionLibraries/ChainAttachDetach.js index 586a01dbd..44dd1e1db 100644 --- a/DesignSpace/Workspace/FunctionLibraries/ChainAttachDetach.js +++ b/DesignSpace/Workspace/FunctionLibraries/ChainAttachDetach.js @@ -7,6 +7,7 @@ function newChainAttachDetach () { return thisObject function chainDetachNode (node, rootNodes) { + if (node.payload.parentNode === undefined) { return } switch (node.type) { case 'Phase': { let payload = node.payload diff --git a/DesignSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js b/DesignSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js index cdf5385dc..68d2cf69f 100644 --- a/DesignSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js +++ b/DesignSpace/Workspace/FunctionLibraries/ReferenceAttachDetach.js @@ -20,5 +20,8 @@ function newReferenceAttachDetach () { function completeDetachment (node) { node.payload.referenceParent = undefined + if (node.savedPayload !== undefined) { + node.savedPayload.referenceParent = undefined + } } } diff --git a/DesignSpace/Workspace/Workspace.js b/DesignSpace/Workspace/Workspace.js index 9bd021d39..033f8ed0b 100644 --- a/DesignSpace/Workspace/Workspace.js +++ b/DesignSpace/Workspace/Workspace.js @@ -374,12 +374,12 @@ function newWorkspace () { break case 'Remove Parent': { - functionLibraryChainAttachDetach.chainDetachNode(payload.node, thisObject.workspaceNode.rootNodes) + chainDetachNode(payload.node) } break case 'Remove Reference': { - payload.referenceParent = undefined + referenceDetachNode(payload.node) } break }