Skip to content

Commit

Permalink
Clean up props destructuring
Browse files Browse the repository at this point in the history
  • Loading branch information
stacimc committed Dec 14, 2021
1 parent 9538d1c commit 26e1095
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/editor/src/components/post-publish-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ export class PostPublishButton extends Component {

createOnClick( callback ) {
return ( ...args ) => {
const { hasNonPostEntityChanges } = this.props;
const {
hasNonPostEntityChanges,
setEntitiesSavedStatesCallback,
} = this.props;
// If a post with non-post entitities is published, but the user
// elects to not save changes to the non-post entities, those
// entities will still be dirty when the Publish button is clicked.
// We also need to check that the `setEntitiesSavedStatesCallback`
// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
if (
hasNonPostEntityChanges &&
this.props.setEntitiesSavedStatesCallback
) {
if ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {
// The modal for multiple entity saving will open,
// hold the callback for saving/publishing the post
// so that we can call it if the post entity is checked.
Expand All @@ -62,7 +62,7 @@ export class PostPublishButton extends Component {
// To set a function on the useState hook, we must set it
// with another function (() => myFunction). Passing the
// function on its own will cause an error when called.
this.props.setEntitiesSavedStatesCallback(
setEntitiesSavedStatesCallback(
() => this.closeEntitiesSavedStates
);
return noop;
Expand Down

0 comments on commit 26e1095

Please sign in to comment.