refactor(actions): combine batch update and update node dimension actions

This commit is contained in:
moklick
2021-02-11 19:14:30 +01:00
parent 9b70e1e0fa
commit 1d1a17c80a
6 changed files with 6 additions and 41 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ const NodeRenderer = (props: NodeRendererProps) => {
const width = useStoreState((state) => state.width);
const height = useStoreState((state) => state.height);
const nodes = useStoreState((state) => state.nodes);
const batchUpdateNodeDimensions = useStoreActions((actions) => actions.batchUpdateNodeDimensions);
const updateNodeDimensions = useStoreActions((actions) => actions.updateNodeDimensions);
const viewportBox = useMemo(() => ({ x: 0, y: 0, width, height }), [width, height]);
const visibleNodes = props.onlyRenderVisibleElements ? getNodesInside(nodes, viewportBox, transform, true) : nodes;
@@ -51,7 +51,7 @@ const NodeRenderer = (props: NodeRendererProps) => {
nodeElement: entry.target as HTMLDivElement,
}));
batchUpdateNodeDimensions(updates);
updateNodeDimensions(updates);
});
}, []);