diff --git a/edit-post/store/effects.js b/edit-post/store/effects.js index 2143abc2018ce..60dd120e6b065 100644 --- a/edit-post/store/effects.js +++ b/edit-post/store/effects.js @@ -54,10 +54,21 @@ const effects = { store.dispatch( setMetaBoxSavedData( dataPerLocation ) ); // Saving metaboxes when saving posts + const { isAutosavingPost } = select( 'core/editor' ); + let shouldRequestMetaBoxUpdates = false; subscribe( onChangeListener( select( 'core/editor' ).isSavingPost, ( isSavingPost ) => { - if ( ! isSavingPost ) { + // Only save metaboxes when this isn't an autosave. + if ( isSavingPost && ! isAutosavingPost( store.getState() ) ) { + shouldRequestMetaBoxUpdates = true; + } + // If a full save just completed, trigger metabox save. + if ( ! isSavingPost && shouldRequestMetaBoxUpdates ) { store.dispatch( requestMetaBoxUpdates() ); } + // Regardless of which save just occurred, reset metabox save state. + if ( ! isSavingPost ) { + shouldRequestMetaBoxUpdates = false; + } } ) ); }, REQUEST_META_BOX_UPDATES( action, store ) {