fix: remove extra rerendering when position changes

This commit is contained in:
medtaher 2024-09-18 14:00:38 +01:00
parent a9838efda5
commit 7495dfef2a

View File

@ -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();