diff --git a/packages/core/src/store/actions.ts b/packages/core/src/store/actions.ts index 09c095d8..a90271c4 100644 --- a/packages/core/src/store/actions.ts +++ b/packages/core/src/store/actions.ts @@ -142,9 +142,11 @@ export function useActions( const style = window.getComputedStyle(viewportNode) const { m22: zoom } = new window.DOMMatrixReadOnly(style.transform) - const changes: NodeDimensionChange[] = [] + const changes: NodeDimensionChange[] = Array.from({ length: updates.length }) + + for (let i = 0; i < updates.length; ++i) { + const update = updates[i] - for (const update of updates) { const node = findNode(update.id) if (node) { @@ -163,11 +165,11 @@ export function useActions( node.handleBounds.target = getHandleBounds('.target', update.nodeElement, nodeBounds, zoom) node.initialized = true - changes.push({ + changes[i] = { id: node.id, type: 'dimensions', dimensions, - }) + } } } }