From 5ac1b6eb379c837a9defbf6ea4907fe15fefe36c Mon Sep 17 00:00:00 2001
From: NathanViaud <nathan.viaud@inria.fr>
Date: Mon, 20 Mar 2023 09:27:09 +0100
Subject: [PATCH] fix

---
 src/features/ePocFlow/nodes/ScreenNode.vue | 2 +-
 src/shared/stores/editorStore.ts           | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/features/ePocFlow/nodes/ScreenNode.vue b/src/features/ePocFlow/nodes/ScreenNode.vue
index 45ef4d94..65c41d80 100644
--- a/src/features/ePocFlow/nodes/ScreenNode.vue
+++ b/src/features/ePocFlow/nodes/ScreenNode.vue
@@ -89,7 +89,7 @@ function change(event) {
         editorStore.changeElementOrder(oldIndex, newIndex, props.id);
 
     } if(event.removed) {
-        editorStore.removeElementFromScreen(event.removed.oldIndex, props.id);
+        editorStore.removeElementFromScreen(event.removed.oldIndex, props.id, true);
     }
 }
 
diff --git a/src/shared/stores/editorStore.ts b/src/shared/stores/editorStore.ts
index b448b0a0..5627782a 100644
--- a/src/shared/stores/editorStore.ts
+++ b/src/shared/stores/editorStore.ts
@@ -138,12 +138,13 @@ export const useEditorStore = defineStore('editor', {
                 node.data.formValues.components.push({ action: action });
             }
         },
-        removeElementFromScreen(index: number, parentNodeId): void {
+        removeElementFromScreen(index: number, parentNodeId, nodeMoved?: boolean): void {
             this.closeFormPanel();
             const node = findNode(parentNodeId);
-
+            
             node.data.elements.splice(index, 1);
-            if(this.openedParentId) {
+
+            if(this.openedParentId || nodeMoved) {
                 node.data.formValues.components.splice(index, 1);
             }
 
-- 
GitLab