diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index d7efb3d84..b41d3f037 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -120,6 +120,9 @@ export default function ParameterComponent({ const handleOnNewValue = ( newValue: string | string[] | boolean | Object[] ): void => { + if (data.node!.template[name].value === newValue) { + return; + } takeSnapshot(); data.node!.template[name].value = newValue; // Set state to pending diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index 9a6f818f2..2d5a552b6 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -134,7 +134,10 @@ export default function GenericNode({ { + takeSnapshot(); + deleteNode(id); + }} setShowNode={(showNode: boolean) => { data.showNode = showNode; }} diff --git a/src/frontend/src/contexts/flowsContext.tsx b/src/frontend/src/contexts/flowsContext.tsx index 4610f126d..32243a9e9 100644 --- a/src/frontend/src/contexts/flowsContext.tsx +++ b/src/frontend/src/contexts/flowsContext.tsx @@ -337,7 +337,6 @@ export function FlowsProvider({ children }: { children: ReactNode }) { const currentfile = (e.target as HTMLInputElement).files![0]; let text = await currentfile.text(); let fileData: FlowType = await JSON.parse(text); - console.log(isComponent, fileData); if ( (!fileData.is_component && isComponent === true) || diff --git a/src/frontend/src/contexts/typesContext.tsx b/src/frontend/src/contexts/typesContext.tsx index 540faa9a8..b806389d4 100644 --- a/src/frontend/src/contexts/typesContext.tsx +++ b/src/frontend/src/contexts/typesContext.tsx @@ -12,7 +12,6 @@ import { APIKindType } from "../types/api"; import { typesContextType } from "../types/typesContext"; import { alertContext } from "./alertContext"; import { AuthContext } from "./authContext"; -import { undoRedoContext } from "./undoRedoContext"; //context to share types adn functions from nodes to flow @@ -44,7 +43,6 @@ export function TypesProvider({ children }: { children: ReactNode }) { const [fetchError, setFetchError] = useState(false); const { setLoading } = useContext(alertContext); const { getAuthentication } = useContext(AuthContext); - const { takeSnapshot } = useContext(undoRedoContext); const [getFilterEdge, setFilterEdge] = useState([]); useEffect(() => { @@ -100,7 +98,6 @@ export function TypesProvider({ children }: { children: ReactNode }) { } function deleteNode(idx: string | Array) { - takeSnapshot(); if (reactFlowInstance === null) return; const edges = reactFlowInstance! .getEdges() @@ -116,7 +113,6 @@ export function TypesProvider({ children }: { children: ReactNode }) { }); } function deleteEdge(idx: string | Array) { - takeSnapshot(); reactFlowInstance!.deleteElements({ edges: typeof idx === "string" ? [{ id: idx }] : idx.map((id) => ({ id })), diff --git a/src/frontend/src/modals/shareModal/index.tsx b/src/frontend/src/modals/shareModal/index.tsx index 01c70f264..37bd9fb19 100644 --- a/src/frontend/src/modals/shareModal/index.tsx +++ b/src/frontend/src/modals/shareModal/index.tsx @@ -71,7 +71,6 @@ export default function ShareModal({ res?.results?.forEach((element: any) => { unavaliableNames.push(element.name); }); - console.log(unavaliableNames); setUnavaliableNames(unavaliableNames); }); } diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx index 499a40f02..54b4bd5c2 100644 --- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx @@ -15,7 +15,6 @@ import ReactFlow, { EdgeChange, NodeChange, NodeDragHandler, - OnEdgesDelete, OnSelectionChangeParams, SelectionDragHandler, addEdge, @@ -124,6 +123,7 @@ export default function Page({ lastSelection ) { event.preventDefault(); + takeSnapshot(); deleteNode(lastSelection.nodes.map((node) => node.id)); deleteEdge(lastSelection.edges.map((edge) => edge.id)); } @@ -271,11 +271,6 @@ export default function Page({ takeSnapshot(); }, [takeSnapshot]); - const onEdgesDelete: OnEdgesDelete = useCallback(() => { - // 👇 make deleting edges undoable - takeSnapshot(); - }, [takeSnapshot]); - const onDragOver = useCallback((event: React.DragEvent) => { event.preventDefault(); if (event.dataTransfer.types.some((types) => types === "nodedata")) { @@ -461,7 +456,6 @@ export default function Page({ onSelectionDragStart={onSelectionDragStart} onSelectionEnd={onSelectionEnd} onSelectionStart={onSelectionStart} - onEdgesDelete={onEdgesDelete} connectionLineComponent={ConnectionLineComponent} onDragOver={onDragOver} onDrop={onDrop} diff --git a/src/frontend/src/utils/storeUtils.ts b/src/frontend/src/utils/storeUtils.ts index deb0d7ee5..8738bac75 100644 --- a/src/frontend/src/utils/storeUtils.ts +++ b/src/frontend/src/utils/storeUtils.ts @@ -17,8 +17,6 @@ export function getTagsIds( tags: string[], tagListId: { name: string; id: string }[] ) { - console.log(tags); - console.log(tagListId); return tags .map((tag) => tagListId.find((tagObj) => tagObj.name === tag))! .map((tag) => tag!.id);