From 69aa8256f0b06ee8475281e767d4eee98a739d85 Mon Sep 17 00:00:00 2001 From: pranjal-joshi Date: Mon, 18 May 2026 03:03:28 +0000 Subject: [PATCH] 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 --- frontend/src/components/canvas/nodes/GroupRectNode.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/canvas/nodes/GroupRectNode.tsx b/frontend/src/components/canvas/nodes/GroupRectNode.tsx index 581f391..cbb8a5b 100644 --- a/frontend/src/components/canvas/nodes/GroupRectNode.tsx +++ b/frontend/src/components/canvas/nodes/GroupRectNode.tsx @@ -55,7 +55,7 @@ export function GroupRectNode({ id, data, selected }: NodeProps>) 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'