From 3df709bb11c7137386055624a19e2af0b2a8017d Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Thu, 10 Jun 2021 12:10:57 +1000 Subject: [PATCH] Save deleted and restored widgets. (#32534) --- packages/edit-widgets/src/store/actions.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/edit-widgets/src/store/actions.js b/packages/edit-widgets/src/store/actions.js index c14a30259556f..555cd2d31d8ba 100644 --- a/packages/edit-widgets/src/store/actions.js +++ b/packages/edit-widgets/src/store/actions.js @@ -140,7 +140,9 @@ export function* saveWidgetArea( widgetAreaId ) { // since order is important. sidebarWidgetsIds.push( widgetId ); - if ( widgetId ) { + // We need to check for the id in the widget object here, because a deleted + // and restored widget won't have this id. + if ( widget.id ) { yield dispatch( 'core', 'editEntityRecord',