Skip to content
Merged
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
13 changes: 5 additions & 8 deletions packages/edit-widgets/src/store/transformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export function transformWidgetToBlock( widget ) {
export function transformBlockToWidget( block, relatedWidget = {} ) {
let widget;

if ( block.name === 'core/legacy-widget' ) {
const isValidLegacyWidgetBlock =
block.name === 'core/legacy-widget' &&
( block.attributes.id || block.attributes.instance );

if ( isValidLegacyWidgetBlock ) {
widget = {
...relatedWidget,
id: block.attributes.id ?? relatedWidget.id,
Expand All @@ -56,13 +60,6 @@ export function transformBlockToWidget( block, relatedWidget = {} ) {
};
}

// Delete deprecated properties.
delete widget.description;
delete widget.name;
delete widget.number;
delete widget.settings;
delete widget.widget_class;
Copy link
Member Author

@noisysocks noisysocks Jun 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed these in #30853 🙂


// Delete read-only properties.
delete widget.rendered;
delete widget.rendered_form;
Expand Down