From 9a7e4ac9529e8308dcfb90c3271a9adb8bd475c0 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 7 Jun 2024 10:44:59 +0200 Subject: [PATCH] refactor(core): use for loop --- packages/core/src/store/actions.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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, - }) + } } } }