Skip to content

Commit

Permalink
Prevent Pre-Publish Panel from Displaying Incorrect Information After…
Browse files Browse the repository at this point in the history
… Navigating away (#67010)

Co-authored-by: sarthaknagoshe2002 <[email protected]>
Co-authored-by: ntsekouras <[email protected]>
Co-authored-by: jameskoster <[email protected]>
  • Loading branch information
4 people authored Nov 19, 2024
1 parent 034c1be commit 5d24deb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/editor/src/components/post-publish-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ export class PostPublishPanel extends Component {
// Automatically collapse the publish sidebar when a post
// is published and the user makes an edit.
if (
prevProps.isPublished &&
! this.props.isSaving &&
this.props.isDirty
( prevProps.isPublished &&
! this.props.isSaving &&
this.props.isDirty ) ||
this.props.currentPostId !== prevProps.currentPostId
) {
this.props.onClose();
}
Expand All @@ -75,6 +76,7 @@ export class PostPublishPanel extends Component {
onTogglePublishSidebar,
PostPublishExtension,
PrePublishExtension,
currentPostId,
...additionalProps
} = this.props;
const {
Expand Down Expand Up @@ -154,6 +156,7 @@ export default compose( [
const { getPostType } = select( coreStore );
const {
getCurrentPost,
getCurrentPostId,
getEditedPostAttribute,
isCurrentPostPublished,
isCurrentPostScheduled,
Expand All @@ -177,6 +180,7 @@ export default compose( [
isSaving: isSavingPost() && ! isAutosavingPost(),
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
isScheduled: isCurrentPostScheduled(),
currentPostId: getCurrentPostId(),
};
} ),
withDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {
Expand Down

0 comments on commit 5d24deb

Please sign in to comment.