Skip to content

Commit

Permalink
Autosave: Fix: Autosave may destroy save incorrect post title
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Sep 18, 2018
1 parent cb908cf commit 5c19314
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/editor/src/components/post-preview-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class PostPreviewButton extends Component {
* Triggers autosave if post is autosaveable.
*/
openPreviewWindow() {
const { isAutosaveable, previewLink, currentPostLink } = this.props;
const { isAutosaveable, isDirty, previewLink, currentPostLink } = this.props;

// Open a popup, BUT: Set it to a blank page until save completes. This
// is necessary because popups can only be opened in response to user
Expand All @@ -81,7 +81,7 @@ export class PostPreviewButton extends Component {
return;
}

if ( ! isAutosaveable ) {
if ( ! isAutosaveable || ! isDirty ) {
this.setPreviewWindowLink( previewLink );
return;
}
Expand Down

0 comments on commit 5c19314

Please sign in to comment.