Skip to content

Commit 9a7e4ac

Browse files
committed
refactor(core): use for loop
1 parent cd5103e commit 9a7e4ac

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/core/src/store/actions.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,11 @@ export function useActions(
142142
const style = window.getComputedStyle(viewportNode)
143143
const { m22: zoom } = new window.DOMMatrixReadOnly(style.transform)
144144

145-
const changes: NodeDimensionChange[] = []
145+
const changes: NodeDimensionChange[] = Array.from({ length: updates.length })
146+
147+
for (let i = 0; i < updates.length; ++i) {
148+
const update = updates[i]
146149

147-
for (const update of updates) {
148150
const node = findNode(update.id)
149151

150152
if (node) {
@@ -163,11 +165,11 @@ export function useActions(
163165
node.handleBounds.target = getHandleBounds('.target', update.nodeElement, nodeBounds, zoom)
164166
node.initialized = true
165167

166-
changes.push({
168+
changes[i] = {
167169
id: node.id,
168170
type: 'dimensions',
169171
dimensions,
170-
})
172+
}
171173
}
172174
}
173175
}

0 commit comments

Comments
 (0)