From 24ae0ad27635c358f1b4ddce841b57abd3f31546 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Wed, 4 Mar 2015 17:10:11 -0700 Subject: [PATCH] ensure unique key --- ComponentInterpolator.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ComponentInterpolator.js b/ComponentInterpolator.js index cb8dc38..8d0bde0 100644 --- a/ComponentInterpolator.js +++ b/ComponentInterpolator.js @@ -47,7 +47,7 @@ var ComponentInterpolator = React.createClass({ }, interpolateAllComponents(tokens, eof) { - var token, child + var token, child; var children = []; var wrappers = this.props.wrappers || {}; while (tokens.length) { @@ -57,9 +57,9 @@ var ComponentInterpolator = React.createClass({ invariant( child = wrappers[token], ` expected '${token}' wrapper, none found` - ) + ); child = cloneWithProps(child, { - key: token, + key: tokens.length, children: this.interpolateAllComponents(tokens, token) }); children.push(child); @@ -82,7 +82,8 @@ var ComponentInterpolator = React.createClass({ invariant( child = this.props[token], ` expected '${token}' placeholder value, none found` - ) + ); + child = cloneWithProps(child, {key: tokens.length}); children.push(child); } else { children.push(token);