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

InnerBlocks: Fix regression where setting a template also locked it #7723

Closed
Closed
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
5 changes: 4 additions & 1 deletion editor/components/inner-blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ class InnerBlocks extends Component {
}

componentDidUpdate( prevProps ) {
const { template, block } = this.props;
const { template, templateLock, block } = this.props;

this.updateNestedSettings();
if ( templateLock !== 'all' && block.innerBlocks && block.innerBlocks.length > 0 ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're checking truthiness of block.innerBlocks before testing length here but not below in the assignment of isTemplateInnerBlockMismatch. We should be consistent one way or the other, depending on whether we actually need to be defensive.

return;
}

const hasTemplateChanged = ! isEqual( template, prevProps.template );
const isTemplateInnerBlockMismatch = (
Expand Down