From 6547d7ffcb19eafe4ef4799e59dc8fe66558efaa Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Wed, 3 May 2017 17:23:29 -0400 Subject: [PATCH] Unset keys when concatenating child elements --- element/index.js | 6 +++--- element/test/index.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/element/index.js b/element/index.js index 8c8b2762a88755..056aec1c31a043 100644 --- a/element/index.js +++ b/element/index.js @@ -77,11 +77,11 @@ export function renderToString( element ) { * @return {Array} The concatenated value */ export function concatChildren( ...childrens ) { - return childrens.reduce( ( memo, children, i ) => { - Children.forEach( children, ( child, j ) => { + return childrens.reduce( ( memo, children ) => { + Children.forEach( children, ( child ) => { if ( child && 'string' !== typeof child ) { child = cloneElement( child, { - key: [ i, j ].join() + key: undefined } ); } diff --git a/element/test/index.js b/element/test/index.js index 842ac6a0465e16..981869e5da7edb 100644 --- a/element/test/index.js +++ b/element/test/index.js @@ -45,14 +45,14 @@ describe( 'element', () => { expect( concatChildren( [ 'a' ], 'b' ) ).to.eql( [ 'a', 'b' ] ); } ); - it( 'should concat the object arrays and rewrite keys', () => { + it( 'should concat the object arrays and unset keys', () => { const concat = concatChildren( [ createElement( 'strong', {}, 'Courgette' ) ], createElement( 'strong', {}, 'Concombre' ) ); expect( concat.length ).to.equal( 2 ); - expect( concat[ 0 ].key ).to.equal( '0,0' ); - expect( concat[ 1 ].key ).to.equal( '1,0' ); + expect( concat[ 0 ].key ).to.be.null(); + expect( concat[ 1 ].key ).to.be.null(); } ); } ); } );