Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 8 additions & 11 deletions editor/store/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,10 @@ export default {
TRASH_POST_SUCCESS( action ) {
const { postId, postType } = action;

// Delay redirect to ensure store has been updated with the successful trash.
setTimeout( () => {
window.location.href = getWPAdminURL( 'edit.php', {
trashed: 1,
post_type: postType,
ids: postId,
} );
window.location.href = getWPAdminURL( 'edit.php', {
trashed: 1,
post_type: postType,
ids: postId,
} );
},
TRASH_POST_FAILURE( action, store ) {
Expand Down Expand Up @@ -308,17 +305,17 @@ export default {
effects.push( resetBlocks( blocks ) );
}

// Resetting post should occur after blocks have been reset, since it's
// the post reset that restarts history (used in dirty detection).
effects.push( resetPost( post ) );

// Include auto draft title in edits while not flagging post as dirty
if ( post.status === 'auto-draft' ) {
effects.push( setupNewPost( {
title: post.title.raw,
} ) );
}

// Resetting post should occur after blocks have been reset, since it's
// the post reset that restarts history (used in dirty detection).
effects.push( resetPost( post ) );

return effects;
},
FETCH_REUSABLE_BLOCKS( action, store ) {
Expand Down
6 changes: 3 additions & 3 deletions editor/store/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ export const editor = flow( [
// Track undo history, starting at editor initialization.
partialRight( withHistory, { resetTypes: [ 'SETUP_EDITOR' ] } ),

// Track whether changes exist, starting at editor initialization and
// resetting at each post save.
partialRight( withChangeDetection, { resetTypes: [ 'SETUP_EDITOR', 'RESET_POST' ] } ),
// Track whether changes exist, resetting at each post save. Relies on
// editor initialization firing post reset as an effect.
partialRight( withChangeDetection, { resetTypes: [ 'RESET_POST' ] } ),
] )( {
edits( state = {}, action ) {
switch ( action.type ) {
Expand Down
2 changes: 1 addition & 1 deletion editor/store/test/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ describe( 'effects', () => {
const result = handler( { post, settings: {} } );

expect( result ).toEqual( [
resetPost( post ),
setupNewPost( { title: 'A History of Pork' } ),
resetPost( post ),
] );
} );
} );
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"redux": "3.7.2",
"redux-multi": "0.1.12",
"redux-optimist": "0.0.2",
"refx": "2.1.0",
"refx": "3.0.0",
"rememo": "2.3.4",
"showdown": "1.7.4",
"simple-html-tokenizer": "0.4.1",
Expand Down