Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent Pre-Publish Panel from Displaying Incorrect Information After Navigating away #67010

Merged
merged 5 commits into from
Nov 19, 2024
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
Loading