From a0a4a34b518bdc58af1df9c496edd82a653268aa Mon Sep 17 00:00:00 2001 From: Rastislav Lamos Date: Thu, 15 Jun 2017 14:23:59 +0200 Subject: [PATCH] Add unique instance ids to the latest posts `edit` component --- blocks/library/latest-posts/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/blocks/library/latest-posts/index.js b/blocks/library/latest-posts/index.js index 80378f955b008..a3fb8f2a07089 100644 --- a/blocks/library/latest-posts/index.js +++ b/blocks/library/latest-posts/index.js @@ -4,6 +4,7 @@ import { Placeholder, FormToggle } from 'components'; import { __ } from 'i18n'; import moment from 'moment'; +import { withInstanceId } from 'components'; /** * Internal dependencies @@ -25,7 +26,7 @@ registerBlockType( 'core/latestposts', { displayPostDate: false, }, - edit: class extends wp.element.Component { + edit: withInstanceId( class extends wp.element.Component { constructor() { super( ...arguments ); @@ -63,10 +64,10 @@ registerBlockType( 'core/latestposts', { ); } - const { focus } = this.props; + const { focus, instanceId } = this.props; const { displayPostDate } = this.props.attributes; - const displayPostDateId = 'post-date-toggle'; + const displayPostDateId = `post-date-toggle-${ instanceId }`; return [ focus && ( @@ -106,7 +107,7 @@ registerBlockType( 'core/latestposts', { this.latestPostsRequest.abort(); } } - }, + } ), save() { return null;