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:
@@ -55,7 +55,7 @@ export function GroupRectNode({ id, data, selected }: NodeProps<Node<NodeData>>)
|
|||||||
const posStyle = POSITION_STYLES[textPos]
|
const posStyle = POSITION_STYLES[textPos]
|
||||||
|
|
||||||
// Count children for collapse badge
|
// 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'
|
const outsideJustify = textPos.includes('right') ? 'flex-end'
|
||||||
: (textPos.includes('center') || textPos === 'center') ? 'center'
|
: (textPos.includes('center') || textPos === 'center') ? 'center'
|
||||||
|
|||||||
Reference in New Issue
Block a user