Skip to content

Commit

Permalink
Editor: Fix Pages always being marked as dirty (#6866)
Browse files Browse the repository at this point in the history
This effectively reverts 0556ad0 where the bug was introduced.
  • Loading branch information
nylen authored Jul 18, 2016
1 parent ca92df0 commit 1913d28
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions client/state/posts/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,10 @@ export const isEditedPostDirty = createSelector(
const edits = getPostEdits( state, siteId, postId );

return some( edits, ( value, key ) => {
if ( key === 'type' ) {
return false;
}

if ( post ) {
return post[ key ] !== value;
}
Expand Down
4 changes: 2 additions & 2 deletions client/state/posts/test/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ describe( 'selectors', () => {
expect( isDirty ).to.be.false;
} );

it( 'should return true if newly edited with custom type', () => {
it( 'should return false if newly edited with custom type', () => {
const isDirty = isEditedPostDirty( {
posts: {
items: {},
Expand All @@ -947,7 +947,7 @@ describe( 'selectors', () => {
}
}, 2916284 );

expect( isDirty ).to.be.true;
expect( isDirty ).to.be.false;
} );

it( 'should return false if no saved post and value matches default for new post', () => {
Expand Down

0 comments on commit 1913d28

Please sign in to comment.