Skip to content

Commit

Permalink
Avoid passing isActive as callback
Browse files Browse the repository at this point in the history
Since it’s known at time of render
  • Loading branch information
aduth committed May 26, 2017
1 parent 630256e commit 8c42fdd
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions blocks/block-controls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ import { Fill } from 'react-slot-fill';
import Toolbar from 'components/toolbar';

export default function BlockControls( { controls } ) {
controls = controls.map( ( control ) => ( {
...control,
isActive: !! control.isActive && control.isActive(),
} ) );

return (
<Fill name="Formatting.Toolbar">
<Toolbar controls={ controls } />
Expand Down
2 changes: 1 addition & 1 deletion blocks/library/heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ registerBlock( 'core/heading', {
'123456'.split( '' ).map( ( level ) => ( {
icon: 'heading',
title: wp.i18n.sprintf( wp.i18n.__( 'Heading %s' ), level ),
isActive: () => 'H' + level === nodeName,
isActive: 'H' + level === nodeName,
onClick: () => setAttributes( { nodeName: 'H' + level } ),
subscript: level,
} ) )
Expand Down

0 comments on commit 8c42fdd

Please sign in to comment.