diff --git a/packages/story-editor/src/components/panels/layer/groupLayer.js b/packages/story-editor/src/components/panels/layer/groupLayer.js index 052229e1d300..5fb65ebc2dbe 100644 --- a/packages/story-editor/src/components/panels/layer/groupLayer.js +++ b/packages/story-editor/src/components/panels/layer/groupLayer.js @@ -78,7 +78,12 @@ function GroupLayer({ groupId }) { }) ); - const { name, isLocked, isCollapsed } = groups[groupId]; + // Destructuring with default values in case groups[groupId] is undefined + const { + name = '', + isLocked = false, + isCollapsed = false, + } = groups?.[groupId] || {}; const { isSelected, handleClick } = useGroupSelection(groupId); diff --git a/packages/story-editor/src/components/panels/layer/groupLayerActions.js b/packages/story-editor/src/components/panels/layer/groupLayerActions.js index af54d78b5f76..75bf908d2e16 100644 --- a/packages/story-editor/src/components/panels/layer/groupLayerActions.js +++ b/packages/story-editor/src/components/panels/layer/groupLayerActions.js @@ -49,7 +49,12 @@ function GroupLayerActions({ groupId }) { ), })); - const group = groups[groupId]; + const group = groups?.[groupId] || { + name: '', + isLocked: false, + isCollapsed: false, + }; + const allLayersHidden = groupLayers.every((layer) => layer.isHidden); const visibilityTitle = allLayersHidden