Skip to content

Commit

Permalink
Changes per review
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Dec 20, 2016
1 parent 107957e commit f38d7ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion client/post-editor/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import PostEditor from './post-editor';
import { setEditorPostId } from 'state/ui/editor/actions';
import { getSelectedSiteId } from 'state/ui/selectors';
import { getEditorPostId, getEditorPath } from 'state/ui/editor/selectors';
import { editPost } from 'state/posts/actions';
import { editPost, resetPostEdits } from 'state/posts/actions';

function getPostID( context ) {
if ( ! context.params.post || 'new' === context.params.post ) {
Expand Down Expand Up @@ -115,6 +115,7 @@ module.exports = {

function startEditing( siteId ) {
context.store.dispatch( setEditorPostId( postID ) );
context.store.dispatch( resetPostEdits( siteId, postID ) );
context.store.dispatch( editPost( siteId, postID, { type: postType } ) );

if ( maybeRedirect( context ) ) {
Expand Down
2 changes: 1 addition & 1 deletion client/post-editor/post-editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const PostEditor = React.createClass( {
const { siteId, postId } = this.props;

// When switching posts, reset post edits for the post we're leaving
if ( nextProps.postId !== postId ) {
if ( nextProps.siteId !== siteId || nextProps.postId !== postId ) {
this.props.resetPostEdits( siteId, postId );
}

Expand Down

0 comments on commit f38d7ba

Please sign in to comment.