From e30fddfa44b55cf3bcee74fa8d92155e3ee0d331 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Wed, 17 May 2017 17:36:48 -0400 Subject: [PATCH] Avoid passing isActive as callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since it’s known at time of render --- blocks/block-controls/index.js | 5 ----- blocks/library/heading/index.js | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/blocks/block-controls/index.js b/blocks/block-controls/index.js index b3c93c7e840d5..d95c6c7cb422f 100644 --- a/blocks/block-controls/index.js +++ b/blocks/block-controls/index.js @@ -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 ( diff --git a/blocks/library/heading/index.js b/blocks/library/heading/index.js index 72f9896120023..fa6a0cca13655 100644 --- a/blocks/library/heading/index.js +++ b/blocks/library/heading/index.js @@ -79,7 +79,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, } ) )