From 7495dfef2aaad29e0fec25a28715a0fd09215a02 Mon Sep 17 00:00:00 2001 From: medtaher Date: Wed, 18 Sep 2024 14:00:38 +0100 Subject: [PATCH] fix: remove extra rerendering when position changes --- frontend/src/components/visual-editor/v2/Diagrams.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/visual-editor/v2/Diagrams.tsx b/frontend/src/components/visual-editor/v2/Diagrams.tsx index 0e9aac3..b12e210 100644 --- a/frontend/src/components/visual-editor/v2/Diagrams.tsx +++ b/frontend/src/components/visual-editor/v2/Diagrams.tsx @@ -48,7 +48,6 @@ import { IBlock } from "@/types/block.types"; import { ICategory } from "@/types/category.types"; import { BlockPorts } from "@/types/visual-editor.types"; - import BlockDialog from "../BlockDialog"; import { ZOOM_LEVEL } from "../constants"; import { useVisualEditor } from "../hooks/useVisualEditor"; @@ -273,7 +272,13 @@ const Diagrams = () => { zoomUpdated: debouncedZoomEvent, offsetUpdated: debouncedOffsetEvent, }); - }, [JSON.stringify(blocks)]); + }, [ + JSON.stringify( + blocks.map((b) => { + return { ...b, position: undefined, updatedAt: undefined }; + }), + ), + ]); const handleDeleteButton = () => { const selectedEntities = engine?.getModel().getSelectedEntities();