Skip to content

Commit

Permalink
Reinstating useEffect so that we can react to changes in the style …
Browse files Browse the repository at this point in the history
…state.
  • Loading branch information
ramonjd committed Nov 15, 2022
1 parent 6d8bc19 commit 4f1fd81
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/block-library/src/group/placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useBlockProps } from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';
import { store as blocksStore } from '@wordpress/blocks';
import { Path, SVG, Button, Placeholder } from '@wordpress/components';
import { useState } from '@wordpress/element';
import { useState, useEffect } from '@wordpress/element';

/**
* Returns a custom variation icon.
Expand Down Expand Up @@ -97,6 +97,26 @@ export function useShouldShowPlaceHolder( {
usedLayoutType !== 'flex'
);

useEffect( () => {
if (
!! hasInnerBlocks ||
!! backgroundColor ||
!! fontSize ||
!! textColor ||
!! style ||
usedLayoutType === 'flex'
) {
setShowPlaceholder( false );
}
}, [
backgroundColor,
fontSize,
textColor,
style,
usedLayoutType,
hasInnerBlocks,
] );

return [ showPlaceholder, setShowPlaceholder ];
}

Expand Down

0 comments on commit 4f1fd81

Please sign in to comment.