From 4f2c6cc2b30ff25f73d8bca805568ebe30729ebf Mon Sep 17 00:00:00 2001 From: Jorge Date: Tue, 21 May 2019 22:56:52 +0100 Subject: [PATCH] id instead of widgetAreaId + lint fix --- packages/edit-widgets/src/components/header/index.js | 1 - .../edit-widgets/src/components/widget-area/index.js | 10 +++++----- .../edit-widgets/src/components/widget-areas/index.js | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/edit-widgets/src/components/header/index.js b/packages/edit-widgets/src/components/header/index.js index f1b2b56a14db70..3dc3f650e9d8ea 100644 --- a/packages/edit-widgets/src/components/header/index.js +++ b/packages/edit-widgets/src/components/header/index.js @@ -6,7 +6,6 @@ import { Button } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { withDispatch } from '@wordpress/data'; - function Header( { saveWidgetAreas } ) { return (
{ + withSelect( ( select, { id } ) => { const { getBlocksFromWidgetArea, getWidgetArea, } = select( 'core/edit-widgets' ); - const blocks = getBlocksFromWidgetArea( widgetAreaId ); - const widgetAreaName = ( getWidgetArea( widgetAreaId ) || {} ).name; + const blocks = getBlocksFromWidgetArea( id ); + const widgetAreaName = ( getWidgetArea( id ) || {} ).name; return { blocks, widgetAreaName, }; } ), - withDispatch( ( dispatch, { widgetAreaId } ) => { + withDispatch( ( dispatch, { id } ) => { return { updateBlocks( blocks ) { const { updateBlocksInWidgetArea } = dispatch( 'core/edit-widgets' ); - updateBlocksInWidgetArea( widgetAreaId, blocks ); + updateBlocksInWidgetArea( id, blocks ); }, }; } ), diff --git a/packages/edit-widgets/src/components/widget-areas/index.js b/packages/edit-widgets/src/components/widget-areas/index.js index a699dc9d62482f..99a3f1e8689fa6 100644 --- a/packages/edit-widgets/src/components/widget-areas/index.js +++ b/packages/edit-widgets/src/components/widget-areas/index.js @@ -13,7 +13,7 @@ function WidgetAreas( { areas } ) { return areas.map( ( { id }, index ) => ( ) );