From 80353923c33422360a9fd8d28a361b94b73a9b29 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 4 Feb 2021 09:29:48 +0200 Subject: [PATCH] Fix insertUsage persistance in block-editor store (#28694) --- packages/data/src/plugins/persistence/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/data/src/plugins/persistence/index.js b/packages/data/src/plugins/persistence/index.js index cfebe55cac98d8..81d1b6d3ed2ee9 100644 --- a/packages/data/src/plugins/persistence/index.js +++ b/packages/data/src/plugins/persistence/index.js @@ -233,15 +233,16 @@ persistencePlugin.__unstableMigrate = ( pluginOptions ) => { const state = persistence.get(); // Migrate 'insertUsage' from 'core/editor' to 'core/block-editor' - const insertUsage = get( state, [ - 'core/editor', - 'preferences', - 'insertUsage', - ] ); - if ( insertUsage ) { + const editorInsertUsage = state[ 'core/editor' ]?.preferences?.insertUsage; + if ( editorInsertUsage ) { + const blockEditorInsertUsage = + state[ 'core/block-editor' ]?.preferences?.insertUsage; persistence.set( 'core/block-editor', { preferences: { - insertUsage, + insertUsage: { + ...editorInsertUsage, + ...blockEditorInsertUsage, + }, }, } ); }