Skip to content

Commit

Permalink
Add unique instance ids to the latest posts edit component
Browse files Browse the repository at this point in the history
  • Loading branch information
lamosty committed Jun 15, 2017
1 parent 994e6d1 commit a0a4a34
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions blocks/library/latest-posts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { Placeholder, FormToggle } from 'components';
import { __ } from 'i18n';
import moment from 'moment';
import { withInstanceId } from 'components';

/**
* Internal dependencies
Expand All @@ -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 );

Expand Down Expand Up @@ -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 && (
Expand Down Expand Up @@ -106,7 +107,7 @@ registerBlockType( 'core/latestposts', {
this.latestPostsRequest.abort();
}
}
},
} ),

save() {
return null;
Expand Down

0 comments on commit a0a4a34

Please sign in to comment.