Skip to content

Commit

Permalink
Move allowedBlocks outside of component to avoid useMemo use
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronrobertshaw authored and Glen Davies committed Mar 9, 2021
1 parent 50ced8a commit ea5bc3b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/gallery/gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import {
import { VisuallyHidden } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { createBlock } from '@wordpress/blocks';
import { useEffect, useMemo, useRef } from '@wordpress/element';
import { useEffect, useRef } from '@wordpress/element';

/**
* Internal dependencies
*/
import { defaultColumnsNumber } from './shared';

const allowedBlocks = [ 'core/image' ];

export const Gallery = ( props ) => {
const {
attributes,
Expand All @@ -38,7 +40,6 @@ export const Gallery = ( props ) => {
imageCrop,
} = attributes;
const galleryRef = useRef();
const allowedBlocks = useMemo( () => [ 'core/image' ], [] );
const { children, ...innerBlocksProps } = useInnerBlocksProps( blockProps, {
allowedBlocks,
orientation: 'horizontal',
Expand Down

0 comments on commit ea5bc3b

Please sign in to comment.