refactor(updates): only trigger dim updates when dim changed

This commit is contained in:
moklick
2024-04-11 12:31:14 +02:00
parent 63aa0dd713
commit 4fa3a87241
14 changed files with 57 additions and 53 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ import {
adoptUserNodes,
updateAbsolutePositions,
panBy as panBySystem,
updateNodeDimensions as updateNodeDimensionsSystem,
updateNodeInternals as updateNodeInternalsSystem,
updateConnectionLookup,
handleParentExpand,
NodeChange,
@@ -71,7 +71,7 @@ const createRFStore = ({
// Every node gets registerd at a ResizeObserver. Whenever a node
// changes its dimensions, this function is called to measure the
// new dimensions and update the nodes.
updateNodeDimensions: (updates) => {
updateNodeInternals: (updates) => {
const {
onNodesChange,
fitView,
@@ -84,9 +84,9 @@ const createRFStore = ({
debug,
} = get();
const changes = updateNodeDimensionsSystem(updates, nodeLookup, domNode, nodeOrigin);
const { changes, updatedInternals } = updateNodeInternalsSystem(updates, nodeLookup, domNode, nodeOrigin);
if (changes.length === 0) {
if (!updatedInternals) {
return;
}