Skip to content

Commit

Permalink
Fix error with defaultColumnsNumber when attributes.ids is not set
Browse files Browse the repository at this point in the history
Make InnerBlocks self closing in save method
  • Loading branch information
Glen Davies committed Oct 7, 2020
1 parent 11a028c commit adaee2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const Gallery = ( props ) => {
__experimentalItemCallback={ ( item ) => (
<li className="wp-block-gallery__image">{ item }</li>
) }
></InnerBlocks>
/>

{ mediaPlaceholder }
<RichTextVisibilityHelper
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/gallery/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { get, pick } from 'lodash';

export function defaultColumnsNumber( attributes ) {
return Math.min( 3, attributes.ids.length );
return attributes?.ids?.length ? Math.min( 3, attributes.ids.length ) : 3;
}

export const pickRelevantMediaFiles = ( image, sizeSlug = 'large' ) => {
Expand Down

0 comments on commit adaee2c

Please sign in to comment.