From f669754f9328bffbca9505487700da00032c1e05 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Wed, 23 May 2018 17:22:47 -0400 Subject: [PATCH] Prevent autosaves if an autosave is in progress. --- editor/components/autosave-monitor/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/editor/components/autosave-monitor/index.js b/editor/components/autosave-monitor/index.js index 02005baeeca97a..2c70e657d0fc06 100644 --- a/editor/components/autosave-monitor/index.js +++ b/editor/components/autosave-monitor/index.js @@ -6,7 +6,12 @@ import { withSelect, withDispatch } from '@wordpress/data'; export class AutosaveMonitor extends Component { componentDidUpdate( prevProps ) { - const { isDirty, isSaveable, isAutosaveable } = this.props; + const { isDirty, isSaveable, isAutosaveable, isAutosaving } = this.props; + + // Prevent autosaves if an autosave is in progress. + if ( isAutosaving ) { + return; + } if ( prevProps.isDirty !== isDirty || prevProps.isSaveable !== isSaveable || @@ -43,6 +48,7 @@ export default compose( [ isEditedPostSaveable, isPostAutosaveable, getEditorSettings, + isAutosavingPost, } = select( 'core/editor' ); const { autosaveInterval } = getEditorSettings(); return { @@ -50,6 +56,7 @@ export default compose( [ isSaveable: isEditedPostSaveable(), isAutosaveable: isPostAutosaveable(), autosaveInterval: autosaveInterval, + isAutosaving: isAutosavingPost(), }; } ),