Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layers: Prevent crash when undoing layer grouping #13495

Merged
merged 5 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@
})
);

const { name, isLocked, isCollapsed } = groups[groupId];
// Destructuring with default values in case groups[groupId] is undefined
const {
name = '',
isLocked = false,
isCollapsed = false,
} = groups?.[groupId] || {};

Check warning on line 86 in packages/story-editor/src/components/panels/layer/groupLayer.js

View check run for this annotation

Codecov / codecov/patch

packages/story-editor/src/components/panels/layer/groupLayer.js#L86

Added line #L86 was not covered by tests

const { isSelected, handleClick } = useGroupSelection(groupId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@
),
}));

const group = groups[groupId];
const group = groups?.[groupId] || {

Check warning on line 52 in packages/story-editor/src/components/panels/layer/groupLayerActions.js

View check run for this annotation

Codecov / codecov/patch

packages/story-editor/src/components/panels/layer/groupLayerActions.js#L52

Added line #L52 was not covered by tests
name: '',
isLocked: false,
isCollapsed: false,
};

const allLayersHidden = groupLayers.every((layer) => layer.isHidden);

const visibilityTitle = allLayersHidden
Expand Down
Loading