From 24ece6b38acde63de0c4c51fe8d5fd2376379aed Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Thu, 6 Jan 2022 07:35:32 +0000 Subject: [PATCH] Update groupShapes.ts (#488) --- .../tldraw/src/state/commands/groupShapes/groupShapes.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/tldraw/src/state/commands/groupShapes/groupShapes.ts b/packages/tldraw/src/state/commands/groupShapes/groupShapes.ts index 592bbcdb7..efa291c78 100644 --- a/packages/tldraw/src/state/commands/groupShapes/groupShapes.ts +++ b/packages/tldraw/src/state/commands/groupShapes/groupShapes.ts @@ -10,6 +10,8 @@ export function groupShapes( groupId: string, pageId: string ): TldrawCommand | undefined { + if (ids.length < 2) return + const beforeShapes: Record> = {} const afterShapes: Record> = {} @@ -30,10 +32,9 @@ export function groupShapes( shapesToGroup.push(shape) } else { const childIds = shape.children.filter((id) => !app.getShape(id).isLocked) - otherEffectedGroups.push(shape) idsToGroup.push(...childIds) - shapesToGroup.push(...childIds.map((id) => app.getShape(id))) + shapesToGroup.push(...childIds.map((id) => app.getShape(id)).filter(Boolean)) } }