From abe597823bf15279d03df5295c62b01ee4502af8 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Wed, 31 Jan 2024 11:23:16 +0100 Subject: [PATCH] Fixed undoing not fixing group edges --- src/frontend/src/stores/flowsManagerStore.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/stores/flowsManagerStore.ts b/src/frontend/src/stores/flowsManagerStore.ts index 0204d600c..90d818ef9 100644 --- a/src/frontend/src/stores/flowsManagerStore.ts +++ b/src/frontend/src/stores/flowsManagerStore.ts @@ -24,6 +24,7 @@ import useAlertStore from "./alertStore"; import { useDarkStore } from "./darkStore"; import useFlowStore from "./flowStore"; import { useTypesStore } from "./typesStore"; +import { cloneDeep } from "lodash"; let saveTimeoutId: NodeJS.Timeout | null = null; @@ -328,7 +329,8 @@ const useFlowsManagerStore = create((set, get) => ({ takeSnapshot: () => { const currentFlowId = get().currentFlowId; // push the current graph to the past state - const newState = useFlowStore.getState(); + const flowStore = useFlowStore.getState(); + const newState = {nodes: cloneDeep(flowStore.nodes), edges: cloneDeep(flowStore.edges)}; const pastLength = past[currentFlowId]?.length ?? 0; if ( pastLength > 0 &&