Skip to content

Commit

Permalink
Use wp.element.Fragment instead of wrangling arrays with key props
Browse files Browse the repository at this point in the history
Props @gziolo
  • Loading branch information
westonruter committed Apr 12, 2018
1 parent ca6c96c commit 7a60509
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions assets/js/amp-block-validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,11 @@ var ampBlockValidation = ( function() {
* @return {Function} The edit() method, conditionally wrapped in a notice for AMP validation error(s).
*/
conditionallyAddNotice: function conditionallyAddNotice( BlockEdit ) {
function AmpNoticeBlockEdit( props, children ) {
function AmpNoticeBlockEdit( props ) {
var edit, details;
edit = wp.element.createElement(
BlockEdit,
_.extend( {}, props, { key: 'amp-original-edit' } ),
children
props
);

if ( 0 === props.ampBlockValidationErrors.length ) {
Expand All @@ -340,18 +339,18 @@ var ampBlockValidation = ( function() {
)
] );

return [
return wp.element.createElement(
wp.element.Fragment, {},
wp.element.createElement(
wp.components.Notice,
{
status: 'warning',
isDismissible: false,
key: 'amp-validation-notice'
isDismissible: false
},
details
),
edit
];
);
}

return wp.data.withSelect( function( select, ownProps ) {
Expand Down

0 comments on commit 7a60509

Please sign in to comment.