Skip to content

Commit

Permalink
Turn off autosave interval for mobile (#24415)
Browse files Browse the repository at this point in the history
  • Loading branch information
dratwas committed Aug 7, 2020
1 parent d09ff88 commit 09f7730
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/edit-post/src/components/layout/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class Layout extends Component {
) }
onLayout={ this.onRootViewLayout }
>
<AutosaveMonitor />
<AutosaveMonitor disableIntervalChecks />
<View
style={ getStylesFromColorScheme(
styles.background,
Expand Down
12 changes: 11 additions & 1 deletion packages/editor/src/components/autosave-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,20 @@ export class AutosaveMonitor extends Component {
}

componentDidMount() {
this.setAutosaveTimer();
if ( ! this.props.disableIntervalChecks ) {
this.setAutosaveTimer();
}
}

componentDidUpdate( prevProps ) {
if (
this.props.disableIntervalChecks &&
this.props.editsReference !== prevProps.editsReference
) {
this.props.autosave();

This comment has been minimized.

Copy link
@youknowriad

youknowriad Dec 31, 2020

Contributor

Any particular reason for the autosave call here?

return;
}

if ( ! this.props.isDirty && prevProps.isDirty ) {
this.needsAutosave = false;
return;
Expand Down

0 comments on commit 09f7730

Please sign in to comment.