Fixed undoing not fixing group edges

This commit is contained in:
Lucas Oliveira 2024-01-31 11:23:16 +01:00
commit abe597823b

View file

@ -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<FlowsManagerStoreType>((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 &&