fix: add null-safe default for nodes array in GroupRectNode

- Use nullish coalescing operator to provide empty array default
- Prevents 'Cannot read properties of undefined' error when nodes is undefined
- Fixes failing GroupRectNode tests that don't provide mock nodes

Co-authored-by: CyberClaw <noreply@openclaw.ai>
This commit is contained in:
pranjal-joshi
2026-05-18 03:03:28 +00:00
parent 78b43a300f
commit 69aa8256f0
@@ -55,7 +55,7 @@ export function GroupRectNode({ id, data, selected }: NodeProps<Node<NodeData>>)
const posStyle = POSITION_STYLES[textPos]
// Count children for collapse badge
const childrenCount = nodes.filter((n) => n.parentId === id).length
const childrenCount = (nodes ?? []).filter((n) => n.parentId === id).length
const outsideJustify = textPos.includes('right') ? 'flex-end'
: (textPos.includes('center') || textPos === 'center') ? 'center'