diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md index 8b366ce1..6931ea5b 100644 --- a/packages/react/CHANGELOG.md +++ b/packages/react/CHANGELOG.md @@ -9,6 +9,7 @@ - do not use fallback handle if a specific id is being used - fix `defaultEdgeOptions` markers not being applied - fix `getNodesBounds` and add second param for passing options +- fix `expandParent` for child nodes ## 12.0.0-next.7 diff --git a/packages/react/src/utils/changes.ts b/packages/react/src/utils/changes.ts index 6bcddabd..310b784c 100644 --- a/packages/react/src/utils/changes.ts +++ b/packages/react/src/utils/changes.ts @@ -6,10 +6,7 @@ export function handleParentExpand(updatedElements: any[], updateItem: any) { for (const [index, item] of updatedElements.entries()) { if (item.id === updateItem.parentNode) { const parent = { ...item }; - - if (!parent.computed) { - parent.computed = {}; - } + parent.computed ??= {}; const extendWidth = updateItem.position.x + updateItem.computed.width - parent.computed.width; const extendHeight = updateItem.position.y + updateItem.computed.height - parent.computed.height; @@ -106,7 +103,7 @@ function applyChanges(changes: any[], elements: any[]): any[] { const updatedElement = { ...element }; for (const change of changes) { - applyChange(change, updatedElement, elements); + applyChange(change, updatedElement, updatedElements); } updatedElements.push(updatedElement);